ZMQ_PROXY - Online Linux Manual Page

Section : 3
Updated : 01/21/2023
Source : 0MQ 4​.3​.4
Note : 0MQ Manual

NAMEzmq_proxy − start built−in 0MQ proxy

SYNOPSISint zmq_proxy (void *frontend, void *backend, void *capture);

DESCRIPTIONThe zmq_proxy() function starts the built−in 0MQ proxy in the current application thread​. The proxy connects a frontend socket to a backend socket​. Conceptually, data flows from frontend to backend​. Depending on the socket types, replies may flow in the opposite direction​. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between frontend and backend​. Before calling zmq_proxy() you must set any socket options, and connect or bind both frontend and backend sockets​. The two conventional proxy models are: zmq_proxy() runs in the current thread and returns only if/when the current context is closed​. If the capture socket is not NULL, the proxy shall send all messages, received on both frontend and backend, to the capture socket​. The capture socket should be a ZMQ_PUB, ZMQ_DEALER, ZMQ_PUSH, or ZMQ_PAIR socket​. Refer to zmq_socket(3) for a description of the available socket types​.

EXAMPLE USAGE

Shared QueueWhen 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​.

ForwarderWhen 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://​.

StreamerWhen 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 VALUEThe zmq_proxy() function always returns −1 and errno set to ETERM or EINTR (the 0MQ context associated with either of the specified sockets was terminated) or EFAULT (the provided frontend or backend was invalid)​.

EXAMPLECreating a shared queue proxy. // Create frontend and backend sockets void *frontend = zmq_socket (context, ZMQ_ROUTER); assert (frontend); void *backend = zmq_socket (context, ZMQ_DEALER); assert (backend); // 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 ALSOzmq_bind(3) zmq_connect(3) zmq_socket(3) zmq(7)

AUTHORSThis page was written by the 0MQ community​. To make a change please read the 0MQ Contribution Policy at http://www​.zeromq​.org/docs:contributing​.
0
Johanes Gumabo
Data Size   :   10,780 byte
man-zmq_proxy.3Build   :   2025-03-22, 13:26   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 1,209,260
Visitor ID   :     :  
Visitor IP   :   18.219.89.207   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 25.03.22
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36


Very long time ago, I have the best tutor, Wenzel Svojanovsky. If someone knows the email address of Wenzel Svojanovsky, please send an email to johanesgumabo@gmail.com.
Help me, linux0001.com will expire on July 16, 2025. I have no money to renew it. View detail

If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.