ZMQ Keywords

ZeroMQ is a lightweight reliable messaging protocol. This backend provides a messaging framework which handles keywords based on the ZeroMQ protocol.

ZeroMQ has a single primary weakness as a backend: like real-world KTL, it requires a centralized message “router” which can direct clients to the dispatchers of their choice. Since such routing is a complicated process, the ZeroMQ backend currently makes no attempt to support services with multiple or distinguishable dispatchers. To solve the routing problem, the ZMQ backend implements a “Router” object which tells clients where to find appropriate services. Dispatchers must register with a broker, and if no brokers are available, then dispatchers may try to create a broker.

ZeroMQ is one of the more robust network backends as the clients talk directly to the dispatcher, and client commands are handled by the dispatcher in a blocking fashion.

The primary caveat when

Configuring ZMQ

ZeroMQ works over network protocols and ports, and so requires some configuration. All configuration happens in a configuration file. The path to the configuration file should be passed to the dispatcher as the config argument, and can be passed to the service via the global configuration utilities.

In the most simple case, ZMQ can be configured for a single dispatcher service:

[zmq]
host = localhost
protocol = tcp
publish = 6511
broadcast = 6512
broker = 6513
timeout = 5
mode = broker

Note that ZMQ requires three separate networking ports to distinguish between sequential commands (commands which require a response) and broadcast commands (which do not require a response).

Reference/API

Cauldron.zmq.common Module

Tools common to all ZMQ services.

Functions

check_zmq() Check if ZMQ is available.

Cauldron.zmq.client Module

ZMQ Client Implementation

Classes

Service A client-side KTL service object.
Keyword A client-side KTL keyword object.

Class Inheritance Diagram

Inheritance diagram of Cauldron.zmq.client.Service, Cauldron.zmq.client.Keyword

Cauldron.zmq.dispatcher Module

Dispatcher implementation for ZMQ

Classes

Service A dispatcher is a KTL service server-side.
Keyword A dispatcher-based keyword, which should own its own values.

Class Inheritance Diagram

Inheritance diagram of Cauldron.zmq.dispatcher.Service, Cauldron.zmq.dispatcher.Keyword

Cauldron.zmq.broker Module

A single message broker service to distribute messages between clients and dispatchers.

Classes

ZMQBroker(name, address, pub_address, ...[, ...]) A broker object for handling ZMQ Messaging patterns
NoResponseNecessary
NoDispatcherAvailable Raised when no dispatcher is available.
MultipleDispatchersFound Raised when too many dispatchers are identified for a keyword.

Class Inheritance Diagram

Inheritance diagram of Cauldron.zmq.broker.ZMQBroker, Cauldron.zmq.broker.NoResponseNecessary, Cauldron.zmq.broker.NoDispatcherAvailable, Cauldron.zmq.broker.MultipleDispatchersFound