from small one page howto to huge articles all in one place
 

search text in:





Poll
Which filesystem do you use?






poll results

Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

196714

userrating:

average rating: 1.7 (102 votes) (1=very good 6=terrible)


May 25th. 2007:
Words

486

Views

252324

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

141294

userrating:

average rating: 1.4 (42 votes) (1=very good 6=terrible)


April, 26th. 2006:

Druckversion
You are here: manpages





ZMQ_PROXY_STEERABLE

Section: 0MQ Manual (3)
Updated: 12/31/2016
Index Return to Main Contents
 

NAME

zmq_proxy_steerable - built-in 0MQ proxy with control flow  

SYNOPSIS

int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control);  

DESCRIPTION

The zmq_proxy_steerable() function starts the built-in 0MQ proxy in the current application thread, as zmq_proxy() do. Please, refer to this function for the general description and usage. We describe here only the additional control flow provided by the socket passed as the fourth argument "control".

If the control socket is not NULL, the proxy supports control flow. If PAUSE is received on this socket, the proxy suspends its activities. If RESUME is received, it goes on. If TERMINATE is received, it terminates smoothly. At start, the proxy runs normally as if zmq_proxy was used.

If the control socket is NULL, the function behave exactly as if zmq_proxy had been called.

Refer to zmq_socket(3) for a description of the available socket types. Refer to zmq_proxy(3) for a description of the zmq_proxy.  

EXAMPLE USAGE

cf zmq_proxy  

RETURN VALUE

The zmq_proxy_steerable() function returns 0 if TERMINATE is sent to its control socket. Otherwise, it 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, backend and control sockets
void *frontend = zmq_socket (context, ZMQ_ROUTER);
assert (backend);
void *backend = zmq_socket (context, ZMQ_DEALER);
assert (frontend);
void *control = zmq_socket (context, ZMQ_SUB);
assert (control);

//  Bind sockets to TCP ports
assert (zmq_bind (frontend, "tcp://*:5555") == 0);
assert (zmq_bind (backend, "tcp://*:5556") == 0);
assert (zmq_connect (control, "tcp://*:5557") == 0);

// Subscribe to the control socket since we have chosen SUB here
assert (zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", 0));

//  Start the queue proxy, which runs until ETERM or "TERMINATE"
//  received on the control socket
zmq_proxy_steerable (frontend, backend, NULL, control);

Set up a controller in another node, process or whatever.

void *control = zmq_socket (context, ZMQ_PUB);
assert (control);
assert (zmq_bind (control, "tcp://*:5557") == 0);

// pause the proxy
assert (zmq_send (control, "PAUSE", 5, 0) == 0);

// resume the proxy
assert (zmq_send (control, "RESUME", 6, 0) == 0);

// terminate the proxy
assert (zmq_send (control, "TERMINATE", 9, 0) == 0);
---


SEE ALSO

zmq_proxy(3) zmq_bind(3) zmq_connect(3) zmq_socket(3) zmq(7)  

AUTHORS

This page was written by the 0MQ community. To make a change please read the 0MQ Contribution Policy at m[blue]http://www.zeromq.org/docs:contributingm[].


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXAMPLE USAGE
RETURN VALUE
EXAMPLE
AUTHORS





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 16.9 ms