View on GitHub

ZMQ Service Suite Specs

ZMQ Service Oriented Architecture Suite Specs

Download this project as a .zip file Download this project as a tar.gz file

ZMQ Service Oriented Suite

This project aims to build a set of libraries and useful components to build decoupled and reliable service oriented architectures using Zero MQ. The implementation is inspired by Paranoid Pirate Pattern and Majordomo Patterns and also some of the descriptions are transcript from ZeroMQ guide.

The protocol goals of are:

The overall solution goals are:

Using a brokerless architecture removes the single point of failures but also adds extra complexity. So this is an hybrid approach that will avoid unnecessary complexity. This article contains some useful information about brokerless architectures with pros/const and usefull patterns such as directory service and dynamic discovering.

The overall topology contains:

diagram

The protocol connects a set of client applications, a single/set of broker device/s and a pool of worker applications. Clients and workers connect to broker and both come and go arbitrarily. The broker open two sockets, one front-end for clients and one back-end for workers. We define 'client' applications as those issuing requests, and 'worker' applications as those processing them.

The protocol makes these assumptions:

Protocol Message

The protocol message format is the same for all workflows.

The current broker, client, workers implementation will use http status codes for responses. The errors information will be on payload with correct status code filled in. The service name and verb are not case sensitive.

Future extension points:

Broker

The broker will act only as addressing system receiving and routing request by service name. It implements an internal service managent interface service (SMI) that is reponsible for service instance management, adding and removing services from the cluster. The broker MUST use a ROUTER socket to accept requests from clients, and workers. The broker MAY use a separate socket for each of them or a separated one for each.

Client

The client workflow is fairly simple, it will send message one or more request messages to broker and wait for replies.

In the next dialog the 'C' represents the client and 'B' represents the Broker.

Single request reply

Repeat
  C: Request
  B: Reply

Multiple requests/replies

Repeat
  C: Request
  C: Request
  B: Reply
  B: Reply

Worker

The worker workflows are a mix of a synchronous request-reply dialogs, initiated by the service worker, and an asynchronous heartbeat dialog that operates independently in both directions. This is the synchronous dialog where 'S' represents the worker and 'B' the broker.

The service execute registration accepting requests:

Once
  S: Request to Service Management Interface (SMI) with verb UP
  B: Forward to SMI
  SMI: Reply with status 200

Handles requests:

Repeat
  B: Request
  S: Reply

Disconnect worker:

Once
  S: Request to SMI with verb DOWN
  B: Forward to SMI
  SMI: Reply with status 200

The asynchronous heartbeat dialog operates on the same sockets and works thus:

Repeat (every second):
  S: Request to SMI with verb HEARTBEAT
  B: Forward to SMI
  SMI: Reply with status 200

List of available implementations

Node-js

Ruby