ØMQ over HTTP patterns
HTTP server -> PUB
The client POSTs a message to a publish url:
HTTP server -> SUB
The client makes a long-poll GET request on the subscribe url:
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.
Written: 20 Mar 2011 08:08
Revised: 21 Mar 2011 07:42
If you found this page useful, please rate it up so others will find it.
Who's watching this page?Dominic Luciano
Fernando J Quintero
... and more