ZeroMQ-based python message broker server/client
Go to file
2018-03-27 19:16:08 -07:00
examples fix port range arg 2017-09-17 20:45:57 -07:00
msgbus be less noisy 2018-03-27 19:16:08 -07:00
.gitignore misc fixes 2017-09-17 19:15:02 -07:00
Dockerfile Add dockerfile 2017-10-30 17:08:31 -07:00 remove hardcodings 2017-09-17 16:53:23 -07:00
requirements.txt misc fixes 2017-09-17 19:15:02 -07:00 refactor into package 2017-09-17 14:29:23 -07:00


Simple zeromq-based pubsub client and server

Quick Start

  • Install: python3 install
  • Run server: mbusd -p 7100
  • Connect a peer server: mbusd -p 7200 --peer
  • Dump events: mbussub -p 7100 --channel orderbook
  • Send events: mbuspub -p 7200 -c orderbook -m foo bar baz


Pymsgbus is server/client software for passing messages in a pub-sub pattern. It is built on top of pyzmq. This means you can use it with the native pymsgbus client or raw zeromq sockets. See msgbus/ and msgbus/ for examples.


Given the two peered servers created in Quick Start above, and these imports:

from contextlib import closing
from msgbus.client import MsgbusSubClient

This code would print out messages from the "orderbook" channel:

with closing(MsgbusSubClient(host, port)) as client:
    while True:
        channel, message = client.recv()
        print("On channel '{}' I got '{}'".format(channel, message))

And this code would send a message on the orderbook channel:

with closing(MsgbusSubClient(host, port)) as client:
    for message in messages:"orderbook", "hello world")

Because pymsgbus is built on ZeroMQ, you don't have to start the clients or servers in any specific order. You can start the lister client above and then the servers, and ZeroMQ will handle sorting things out. Of course, messages published when there's no server or no listeners are silently list.


  • Improve performance
  • Create docs