简体   繁体   English

具有主要domo模式的ZMQ实现。 可以在工人经纪人和经纪人客户之间混合连接协议?

[英]ZMQ implemetnation with Major domo pattern. is it possible to mix connection protocols between worker-broker and broker-client?

I have successfully able to connect worker and broker on tcp protocol and then client to broker on tcp. 我已经能够成功地在TCP协议上连接工作程序和代理,然后在TCP上将客户端连接到代理。 Now i am evaluating that is it possible that worker and broker can connect on ipc/inproc protocol while client will connect to broker on tcp. 现在,我正在评估,当客户端将在TCP上连接到代理时,工作程序和代理是否可以通过ipc / inproc协议进行连接。 My workers and broker will be on same machine and might even reside in same process. 我的工人和经纪人将在同一台计算机上,甚至可能位于同一进程中。 My client can connect to my broker from different machine that's why it needed to be on tcp 我的客户端可以从其他计算机连接到我的代理,这就是为什么它需要在tcp上

Can Broker be binded in dual way ? 经纪人可以双重约束吗?

Yes, there's no problem doing what you suggest. 是的,做您的建议没有问题。 Each ZMQ socket operates completely distinct from the other sockets in your code. 每个ZMQ套接字的操作都与代码中的其他套接字完全不同。 It often makes sense to mix connection protocols to optimize communication the way you're looking to do. 混合连接协议以按照您希望的方式优化通信通常很有意义。

One assumption I'm making here is that your broker has 2 sets of sockets: client facing sockets that you can connect via TCP and worker facing sockets that you can connect via some other protocol. 我在这里所做的一个假设是,您的代理具有两组套接字:可以通过TCP连接的面向客户端的套接字,可以通过其他协议进行连接的面向工作者的套接字。 If both client and worker are connecting to the same socket on the broker, then they must connect via the same protocol. 如果客户端和工作程序都连接到代理上的同一套接字,则它们必须通过相同的协议进行连接。

The only thing to consider is whether your workers will always reside in the same process as your broker, or if it might grow to a point where it makes sense to separate them. 唯一要考虑的是,您的工人是否将始终与经纪人处于同一流程中,或者是否可能增长到可以将他们分开的程度。 But, if you define your socket connections in some sort of configurable way, rather than baking it into the code, even that could be a relatively easy fix if you decide to change things down the line. 但是,如果您以某种可配置的方式定义套接字连接,而不是将其烘焙到代码中,那么即使您决定沿线更改内容,即使这样相对较容易解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM