Skip to main content

pyzmq broker and client handlers with name based addressing

Project description

cobblr

This is a package for simple client-broker and client-client communications using the ZeroMQ package for python.

It is designed for M2M communications and easy passing of data between software modules. Each client program runs asynchronously in a single new background thread. Clients are addressed with a unique name and once registered with a broker can request new communications.

This package was built as part of the Digital Manufacturing on a Shoestring Project.

This library is in development.

Please check back soon!

API

from cobblr.cobblr import CobblrBroker
cb = CobblrBroker

Create and start a broker

from cobblr.cobblr import CobblrClient
cl = CobblrClient("cl_test")

Create and start a client named cl_test

cl.register()

Register client cl_test with the running broker

from cobblr.cobblr import CobblrClient
cr = CobblrClient("cr_test")
cr.register()

Create, start and register client cr_test

cl.request_connection("cr_test")

Request a connection to client cr_test from client cl_test

connection_list = cl.get_connected()

Populates connection_list with names of connected clients and broker. The broker is always named service.

cl.send_message("cr_test",["string_1", "string_2"])

Sends a message from client cl_test to client cr_test, consisting of two strings.

msg = ["no_msg"]
while msg == ["no_msg"]:
    msg = cr.get_messages()
print(msg)

Loop to read message inbox on client cr_test. Messages will be returned as a list, with each entry a list of [<message number>, <from address>, <message contents>].

The inbox is cleared on reading.

cr.end

Ends client cr_test.

API for pub-sub to be added soon

Features List

  • Client name registration at broker
  • Single IP space
  • Multiple IP and Network support
  • Request a connection to another named client
  • Request - Response messaging pattern between named clients
  • Publish - Subscribe messaging pattern
  • Simple state machine with task prioritisation
  • Asynchronous background operation
  • Smooth shutdown and restart
  • Heartbeat for network status and awareness
  • Backup broker
  • Network configuration save and load
  • Message encryption

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cobblr-0.1.4.tar.gz (13.7 kB view hashes)

Uploaded Source

Built Distribution

cobblr-0.1.4-py3-none-any.whl (17.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page