[zeromq-dev] Publish-subscribe / Time to live

Martin Sustrik sustrik at 250bpm.com
Mon Aug 2 08:43:46 CEST 2010


Eric Bell wrote:

> 1) With a publish-subscribe pattern, can clients subscribe and 
> unsubscribe at any time? 

Yes.

> I assume that clients will only see messages 
> that were queued after the time they subscribe.

Yes.

> What needs to happen 
> when a client unsubscribes, so messages don't build up in the queueing 
> system waiting for a subscriber who is no longer there?

Nothing has to be done. Messages won't be queued.

> 2) Is there a way to set a time-to-live on messages, so that they expire 
> if they aren't consumed within a certain period of time?
> 
> The relevance to my problem is that if my user (a person) closes their 
> browser, then any messages that were being held for them need to be 
> discarded. A time-out on messages would be the easiest, because I won't 
> have to do anything special to close down ZeroMQ subscribers. Without 
> that, I will need to construct a process that determines when the client 
> has "gone away", so it can perform any clean-up work required by ZeroMQ.

The messages will be discarded automatically when there's nobody to recv 
them.

Martin



More information about the zeromq-dev mailing list