문제

In the ZeroMQ documentation for a REP socket it says:

If the original requester doesn't exist any more the reply is silently discarded.

In my project, I'd like to have some way of knowing that the entity that made the original request is no longer present and listening for a reply. In other words, I'd like an error to be thrown if the reply is going to be discarded.

Is such a thing possible, or must I use some separate channel to check on the requestor or some kind of ACK upon its receipt of the reply?

도움이 되었습니까?

해결책

You should use a separate channel to track the requester since zmq sockets have no way to know that.

You could use request/reply sockets in reverse for that purpose but may suffer from performance issues because inherently you will be making another request/reply before making a reply.

Entity1                 Entity2
Request --------------   Reply
Reply   --------------   Request

and communication flow would be

Entity1 --------> request -----> Entity2
Entity1 <-------  request <----- Entity2
Entity1 --------  reply   ------> Entity2
Entity1 <-------  reply   ------- Entity2

This in now way provides guarantee that Entity1 would not be available for receiving the reply but improves it's probability.

How ever, it may not be a good idea to rquire requester state to be known to replier.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top