ØMQ-over-HTTP discussion

ØMQ over HTTP patterns

HTTP server -> PUB

The client POSTs a message to a publish url:
http://server/pub/subject

HTTP server -> SUB

The client makes a long-poll GET request on the subscribe url:
http://server/sub/subject

To support subscribing to multiple subject the client could send a POST request to the subscribe url with a list of all the subject it is interested in or the server could maintain some session for each client. WebSockets or one of the other client-side socket methods could be used instead of long-poll GET requests.

HTTP server -> XREQ

This should simply map one HTTP request/response to one 0MQ request/response. For GET requests send the full url or the query string as the 0MQ request and the 0MQ response as the HTTP response body. The server could be configured to include the HTTP headers as the first part of the 0MQ request/response messages. Here is a example written in Lua.

XREP -> HTTP client

With this you could re-use existing web-applications running on a HTTP server as backend workers for a work queue. This is like a reverse HTTP proxy which load-balances across multiple backend HTTP servers.

HTTP server -> PUSH

This is like "HTTP server -> XREQ" except you don't care for a response. This would work for pushing messages onto a queue.

HTTP server -> PULL

Basically the HTTP server would be a queue server that clients could GET work from.

Comments: 3

Add a New Comment