我一直在尝试使用ZeroMQ中的示例和示例来构建分布式MQ系统。
我们是否可以创建连接的循环(不是发出的消息):
{
...
...
zmq::context_t context (1);
zmq::socket_t subscriber (context, ZMQ_SUB);
int rc = subscriber.connect("tcp://primary_host:5556");
// I don't want to do this till the first one fails!
// int rc1 = subscriber.connect("tcp://failover_host:5557");
...
}
我想象我的代码理想情况下会是这样的 -
{
...
...
std::vector<std::string> urls = SomeServiceRegistry.getMeMessageServerUrls("SomeTopics_OR_FILTERS");
zmq::context_t context (1);
zmq::socket_t subscriber (context, ZMQ_SUB);
// I would expect this guy to essentially -
// handle - disconnects, and pick up and connect
// to the next one in the vector, eventually, rolling back to the 0th index.
zmq::connect_round_robin(urls);
...
}
想知道是否有预先构建的模式功能来实现这一目标。找不到任何东西。如果我错过任何事情,很高兴得到纠正(......或抨击!)以下是我想要实现的目标 -
我担心我可能会在SUB方面遇到过多的套接字,不好的部分 - 其中一半我可能永远不会使用!
我错过了一些太明显的东西吗?
由于 姆欧