Skip to content

Using RabbitMQ for message passing and Mongo DB to store messages and SQL to query data

Notifications You must be signed in to change notification settings

Shahriar9000/Publish-Subscribe-using-RabbitMQ-and-MongoDB

Repository files navigation

Publish-Subscribe-using-RabbitMQ-and-MongoDB

Dependencies:

  1. RabbitMQ installation:
    https://www.erlang-solutions.com/resources/download.html#tabs-debian
    https://www.vultr.com/docs/how-to-install-rabbitmq-on-ubuntu-16-04-47

  2. AMQP-CPP Library: for interaction with rabbitmq
    sudo apt-get install libev-dev -> to install libev for AMQP-CPP
    sudo apt-get install libssl-dev -> to install openssl library for AMQP-CPP
    Read documentation to install and use:
    https://github.com/CopernicaMarketingSoftware/AMQP-CPP

  3. JSON-CPP Library: for interacting with json
    Installation:
    https://linux.tips/programming/how-to-install-and-use-json-cpp-library-on-ubuntu-linux-os
    Read documentation to use:
    https://github.com/open-source-parsers/jsoncpp

  4. MongoDB Server:
    https://www.mongodb.com/download-center/community

  5. MongoDB Terminal Client:
    sudo apt install mongodb-clients

  6. Mongocxx Driver: for interacting with MongoDB
    Python3 is needed to install libmongoc:
    http://ubuntuhandbook.org/index.php/2017/07/install-python-3-6-1-in-ubuntu-16-04-lts/
    http://mongoc.org/libmongoc/current/installing.html
    http://mongocxx.org/mongocxx-v3/installation/

Compile Publisher:
g++ publisher_demo.cpp -o publish -std=c++11 -lamqpcpp -lpthread -ldl -lev -lssl -ljsoncpp

Run Publisher:
./publish example: ./publish 5 mtl_temperature.json mtl_health.json mtl_grade.json mtl_temperature.json mtl_health.json

Note on publisher_demo.cpp: the program will terminate automatically after publishing all data

Compile Consumer:
g++ --std=c++11 consumer_demo.cpp -o consume $(pkg-config --cflags --libs libmongocxx) -Wl,-rpath,/usr/local/lib -lamqpcpp -lpthread -ldl -lev -lssl -ljsoncpp

Run Consumer
./consume

Note on consumer_demo.cpp: the program will keep running and wait for any message to be published

About

Using RabbitMQ for message passing and Mongo DB to store messages and SQL to query data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages