table of contents
other versions
- wheezy-backports 3.2.3+dfsg-2~bpo70+1
- jessie 4.0.5+dfsg-2+deb8u1
- testing 4.2.1-4
- unstable 4.2.1-4
ZMQ_PROXY(3) | 0MQ Manual | ZMQ_PROXY(3) |
NAME¶
zmq_proxy - start built-in 0MQ proxySYNOPSIS¶
int zmq_proxy (const void *frontend, const void *backend, const void *capture);DESCRIPTION¶
The zmq_proxy() function starts the built-in 0MQ proxy in the current application thread.EXAMPLE USAGE¶
Shared Queue¶
When the frontend is a ZMQ_ROUTER socket, and the backend is a ZMQ_DEALER socket, the proxy shall act as a shared queue that collects requests from a set of clients, and distributes these fairly among a set of services. Requests shall be fair-queued from frontend connections and distributed evenly across backend connections. Replies shall automatically return to the client that made the original request.Forwarder¶
When the frontend is a ZMQ_XSUB socket, and the backend is a ZMQ_XPUB socket, the proxy shall act as a message forwarder that collects messages from a set of publishers and forwards these to a set of subscribers. This may be used to bridge networks transports, e.g. read on tcp:// and forward on pgm://.Streamer¶
When the frontend is a ZMQ_PULL socket, and the backend is a ZMQ_PUSH socket, the proxy shall collect tasks from a set of clients and forwards these to a set of workers using the pipeline pattern.RETURN VALUE¶
The zmq_proxy() function always returns -1 and errno set to ETERM (the 0MQ context associated with either of the specified sockets was terminated).EXAMPLE¶
Creating a shared queue proxy.// Create frontend and backend sockets void *frontend = zmq_socket (context, ZMQ_ROUTER); assert (backend); void *backend = zmq_socket (context, ZMQ_DEALER); assert (frontend); // Bind both sockets to TCP ports assert (zmq_bind (frontend, "tcp://*:5555") == 0); assert (zmq_bind (backend, "tcp://*:5556") == 0); // Start the queue proxy, which runs until ETERM zmq_proxy (frontend, backend, NULL);
SEE ALSO¶
zmq_bind(3) zmq_connect(3) zmq_socket(3) zmq(7)AUTHORS¶
This 0MQ manual page was written by Pieter Hintjens < ph@imatix.com[1]>NOTES¶
- 1.
- ph@imatix.com
mailto:ph@imatix.com
05/02/2013 | 0MQ 3.2.2 |