Coder Social home page Coder Social logo

rabbitmq-pdf-processor's Introduction

rabbitmq-pdf-processor

A simple PDF processor using RabbitMQ. The client reads some text and sends it to the server, which will create a PDF from the text and sends it back to the client. The client will then save the PDF in the working directory.

Install RabbitMQ

On Debian Linux, execute the following command:

# apt-get install rabbitmq-server
# systemctl enable rabbitmq-server
# systemctl start rabbitmq-server
# systemctl status rabbitmq-server

The last command should show output similar to

● rabbitmq-server.service - RabbitMQ Messaging Server
     Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; ena>
     Active: active (running) since Mon 2021-05-17 08:22:46 CEST; 5mi>
   Main PID: 7730 (beam.smp)
     Status: "Initialized"
      Tasks: 162 (limit: 19101)
     Memory: 88.0M
        CPU: 8.878s
     CGroup: /system.slice/rabbitmq-server.service
             ├─7730 /usr/lib/erlang/erts-11.1.8/bin/beam.smp -W w -K >
             ├─7941 erl_child_setup 65536
             ├─8015 inet_gethost 4
             └─8016 inet_gethost 4

May 17 08:22:42 tessa systemd[1]: Starting RabbitMQ Messaging Server.>
May 17 08:22:46 tessa systemd[1]: Started RabbitMQ Messaging Server.

Install management plugin

RabbitMQ does not install a management console by default, but the optional web-based plugin makes it easy to peek into a running RabbitMQ instance.

#  rabbitmq-plugins enable rabbitmq_management

Open the URL http://localhost:15672/ with a browser. A login screen should now be shown:

Login

The default user is *guest and the default password is also guest. After login in, the following screen is shown:

Web UI

It is a good idea to change the password of the guest user:

# rabbitmqctl change_password guest new_password

Configure pdf-processor vhost

# rabbitmqctl add_vhost pdf-processor

Refresh the web UI. It should now show the pdf-processor vhost:

pdf-processor vhost

Next we need to allow the guest user to access the pdf-processor vhost:

# rabbitmqctl set_permissions -p pdf-processor guest ".*" ".*" ".*"

Add Pika package

Pika is a RabbitMQ library for Python.

Configure virtual environment

To easily add packages with PyCharm without being super user, first configure a virtual environment. Open the settings dialog and select Python Interpreter:

Python Interpreter settings

Click on the gear icon and add a new Python virtual environment:

Python Virtual Environment

Now add the Pika package

Add Pika package

Add ReportLab package

Install the ReportLab package following the steps given above for the Pika package.

Running

The RabbitMQ username and password need to be passed as command line arguments:

Command line arguments

First start the server, then the client.

rabbitmq-pdf-processor's People

Contributors

mthaler avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.