Skip to content

Latest commit

 

History

History
108 lines (80 loc) · 2.09 KB

README.md

File metadata and controls

108 lines (80 loc) · 2.09 KB

Majordomo Protocol Broker, Client and Worker

Majordomo Protocol

Dependencies

  1. zmq library
  2. zmqpp: zmq library c++ wrapper
  3. json c++ library
# Debian based
sudo apt-get install nlohmann-json3-dev libzmq3-dev

Building

git clone --recurse-submodules https://github.com/wdl83/mdp
cd mdp 
RELEASE=1 make

Build artifacts will be placed in 'obj' dir, if you have not defined OBJ_DIR.

Installing

DST_DIR variable can be used to define prefix (must be absolute) path for:

  1. $DST_DIR/bin
  2. $DST_DIR/lib // zmqpp
  3. $DST_DIR/include // zmqpp
RELEASE=1 DST_DIR=$HOME/opt make install

Building with Docker

git clone https://github.com/wdl83/mdp
cd mdp 
./make_env.sh # generate .env
sudo docker-compose up
grep DST= .env # directory where artifacts are located

Build artifacts will be placed in $DST dir (generated with mktemp -d).

Usage

Broker requires the IP address and listen port. Running manually from console:

broker -a tcp://0.0.0.0:6060

or better as systemd service. Create .config/systemd/user/broker.service

# this config assumes you installed:
# broker in $HOME/bin
# libzmqpp.so* libraries in $HOME/lib
#
[Unit]
Description=MDP Broker

[Service]
Environment=TRACE_LEVEL=2
Environment=LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
ExecStart=$HOME/bin/broker -a tcp://0.0.0.0:6060
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=default.target

After systemd service file is created enable it:

systemctl --user enable broker.service

and start

systemctl --user start broker.service

Enable systemd to start $USER services at boot (no $USER login required)

loginctl enable-linger $USER

Simple Task Processing Flow

diagram

Simple Worker Lifetime

diagram