Zeromq interface function: zmq_proxy_steerable– stop/resume/terminate control to open the built-in ZMQ agent

Source: Internet
Author: User
Tags creative commons attribution

ZeroMQ API directory :http://www.cnblogs.com/fengbohello/p/4230135.html

—————————————————————————————————————

ZeroMQ official address:http://api.zeromq.org/4-1:zmq-proxy-steerable

Zmq_proxy_steerable (3) ØMQ Manual-ømq/4.1.0

Name

zmq_proxy_steerable– stop/resume/terminate control mode to open the built-in ZMQ agent

Synopsis

int zmq_proxy_steerable (constvoidconstvoidconst void  constvoid *control);

Description

The zmq_proxy_steerable () function opens the ZMQ built-in proxy in the current application thread, just like Zmq_proxy (). Please ask the general description and use of this function for grass test. We are only here to discuss the newly added fourth parameter "control". If the control socket is not NULL, the agent supports subsequent control operations. If the socket receives a suspend\0 message, the agent will delay its activity. If a resume\0 message is received, it will continue to work. If a terminate\0 message is received, it will smooth (smoothly) the end. At first, it will work in the same way as Zmq_proxy.

If the control socket is null, this function works the same way as the zmq_proxy.

See the zmq_socket (3) function for a description of the available socket types. Zmq_proxy (3) section gets a description of the zmq_proxy.

Example usage

See zmq_proxy

Return value

When the control socket receives TERMINATE , the zmq_proxy_steerable () function returns 0. Otherwise, return-1, and set errno to eterm(ZMQ context is terminated, or the specified socket is terminated).

Example

  To create a shared agent queue

//Create frontend, backend and control socketsvoid*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 portsASSERT (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 a chosen SUB hereASSERT (Zmq_setsockopt (control, Zmq_subscribe,"",0));//Start the queue proxy, which runs until Eterm or "TERMINATE" received on the control socket Zmq_proxy (frontend, BAC Kend, NULL, control);

  Create a controller on another node, process or other

void*control =zmq_socket (context, zmq_pub), assert (Control), Assert (Zmq_bind (Control,"tcp://*:5557") ==0);//Stop the proxyASSERT (Control, zmq_send"STOP",5,0) ==0);//Resume the proxyASSERT (Control, zmq_send"RESUME",7,0) ==0);//terminate the proxyASSERT (Control, zmq_send"TERMINATE",Ten,0) ==0);

See Also

Zmq_proxy (3) Zmq_bind (3) zmq_connect (3) Zmq_socket (3) ZMQ (7)

Authors

This page is written by Theømq community. A change of THEØMQ contribution Policy at http://www.zeromq.org/docs:contributing.

WEB site design and content is copyright (c) 2007-2012 Imatix Corporation. Contact us for professional support. Site content licensed under the Creative Commons attribution-share alike 3.0 License. ØMQ is copyright (c) Copyright (c) 2007-2012 Imatix Corporation and Contributors. ØMQ is free software licensed under the LGPL. ØMQ, ZeroMQ, and 0MQ are trademarks of Imatix Corporation. Terms of Use-privacy

Policy

Translation: The Storm

Mail: [Email protected]

Zeromq interface function: zmq_proxy_steerable– stop/resume/terminate control to open the built-in ZMQ agent

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.