ZeroMQ接口函数之 :zmq_proxy_steerable – 以STOP/RESUME/TERMINATE控制方式开启内置的ZMQ代理
ZeroMQ API 目录 :http://www.cnblogs.com/fengbohello/p/4230135.html
—————————————————————————————————————
ZeroMQ 官方地址: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控制方式开启内置的ZMQ代理
Synopsis
int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control);
Description
zmq_proxy_steerable()函数会在当前的应用线程中开启ZMQ内置的代理,就和zmq_proxy()一样。请草考这个函数的一般描述和使用。我们只在这里只讨论新增加的第四个参数“control”。如果控制socket不为NULL,这个代理支持后续的控制操作。如果这个socket接收到SUSPEND\0消息,此代理将延迟它的活动。如果接到了RESUME\0消息,它将继续工作。如果收到了TERMINATE\0消息,它将平滑的(smoothly)结束。在刚开始的是,它将以和zmq_proxy一样的方式工作。
如果控制socket为NULL,此函数和zmq_proxy的工作方式一样。
参见zmq_socket(3)函数获取可用socket类型的描述。zmq_proxy(3)章节获取对zmq_proxy的描述。
Example usage
参见 zmq_proxy
Return value
当控制socket接收到TERMINATE时zmq_proxy_steerable()函数返回0,。否则,返回 -1,并且设置errno为ETERM(ZMQ context被终结了,或者指定的socket呗终结了)。
Example
创建一个共享的代理队列
// 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") == );
assert (zmq_bind (backend, "tcp://*:5556") == );
assert (zmq_connect (control, "tcp://*:5557") == );
// Subscribe to the control socket since we have chosen SUB here
assert (zmq_setsockopt (control, ZMQ_SUBSCRIBE, "", ));
// Start the queue proxy, which runs until ETERM or "TERMINATE" received on the control socket zmq_proxy (frontend, backend, NULL, control);
在另一个节点上创建一个控制器,进程或者其它
void *control = zmq_socket (context, ZMQ_PUB);
assert (control);
assert (zmq_bind (control, "tcp://*:5557") == );
// stop the proxy
assert (zmq_send (control, "STOP", , ) == );
// resume the proxy
assert (zmq_send (control, "RESUME", , ) == );
// terminate the proxy
assert (zmq_send (control, "TERMINATE", , ) == );
See also
zmq_proxy(3) zmq_bind(3) zmq_connect(3) zmq_socket(3) zmq(7)
Authors
This page was written by the ØMQ community. To make a change please read 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
翻译:风波
mail : fengbohello@qq.com
ZeroMQ接口函数之 :zmq_proxy_steerable – 以STOP/RESUME/TERMINATE控制方式开启内置的ZMQ代理的更多相关文章
- ZeroMQ接口函数之 :zmq_version – 返回ZMQ链接库的版本
ZeroMQ 官方地址 :http://api.zeromq.org/4-2:zmq_version zmq_version(3) ØMQ Manual - ØMQ/4.1.0 Na ...
- ZeroMQ接口函数之 :zmq_proxy – 开始ZMQ内置代理
ZeroMQ 官方地址 :http://api.zeromq.org/4-1:zmq-proxy zmq_proxy(3) ØMQ Manual - ØMQ/4.1.0 Nam ...
- ZeroMQ接口函数之 :zmq_setsockopt –设置ZMQ socket的属性
ZeroMQ API 目录 :http://www.cnblogs.com/fengbohello/p/4230135.html 本文地址 :http://www.cnblogs.com/fengbo ...
- ZeroMQ接口函数之 :zmq_getsockopt – 获取ZMQ socket的属性
ZeroMQ API 目录 :http://www.cnblogs.com/fengbohello/p/4230135.html 本文地址 :http://www.cnblogs.com/fengbo ...
- Python之旅Day3 文件操作 函数(递归|匿名|嵌套|高阶)函数式编程 内置方法
知识回顾 常见五大数据类型分类小结:数字.字符串.列表.元组.字典 按存值个数区分:容器类型(列表.字典.元组) 标量原子(数字.字符串) 按是否可变区分:可变(列表.字典) 不可变(数字.字符串.元 ...
- Scrapy——5 下载中间件常用函数、scrapy怎么对接selenium、常用的Setting内置设置有哪些
Scrapy——5 下载中间件常用的函数 Scrapy怎样对接selenium 常用的setting内置设置 对接selenium实战 (Downloader Middleware)下载中间件常用函数 ...
- day15生成器send方法,递归,匿名函数,max结合匿名工作原理,常用的内置函数
复习 ''' 1.带参装饰器 - 自定义 | wraps def wrap(info) def outer1(func): from functools import wraps @wraps(fun ...
- ZeroMQ接口函数之 :zmq - 0MQ 轻量级消息传输内核
官方网址:http://api.zeromq.org/4-0:zmq zmq(7) 0MQ Manual - 0MQ/3.2.5 Name zmq – ØMQ 轻量级消息传输内核 Synopsis # ...
- ZeroMQ接口函数之 :zmq_curve – 安全的认证方式和保密方式
ZeroMQ 官方地址 :http://api.zeromq.org/4-0:zmq_curve zmq_curve(7) ØMQ Manual - ØMQ/4.1.0 Name zmq_curve ...
随机推荐
- sublime text3好用的插件
1.安装package control sublime text3 的安装方法,ctrl+`,调出控制台输入 import urllib.request,os; pf = 'Package Contr ...
- 关于session和cookie
一.cookie机制和session机制的区别 **************************************************************************** ...
- BlockingQueue 阻塞队列,很有用的一种
BlockingQueue的核心方法:放入数据: offer(anObject):表示如果可能的话,将anObject加到BlockingQueue里,即如果BlockingQueue可以容纳, 则返 ...
- 页面localStorage用作数据缓存的简易封装
最近做了一些前端控件的封装,需要用到数据本地存储,开始采用cookie,发现很容易就超过了cookie的容量限制,于是改用localStorage,但localStorage过于简单,没有任何管理和限 ...
- BMP文件格式
- linux c 笔记-4 工程项目阅读推荐
作者:周子涵链接:https://www.zhihu.com/question/27705862/answer/37738315来源:知乎著作权归作者所有,转载请联系作者获得授权. 转自网上不知道什么 ...
- CSS自适应布局(左右固定 中间自适应或者右侧固定 左侧自适应)
经常在工作中或者在面试中会碰到这样的问题,比如我想要个布局 右侧固定宽度 左侧自适应 或者 三列布局 左右固定 中间自适应的问题. 下面我们分别来学习下,当然我也是总结下而已,有如以下方法: 一: 右 ...
- mount挂载问题
安装nfs-utils即可
- testng 教程
Testng 简介: Testng是一套开源测试框架,是从Junit继承而来,testng意为test next generation,主要有以下特性: annotations 注释,如 @test ...
- 曲线救国:IIS7集成模式下如何获取网站的URL
如果我们在Global中的Application_Start事件中访问HttpContext.Current.Request对象,如: protected void Application_Start ...