I'm new to zeromq so please forgive me if this is obvious, but I couldn't find 
the answer anywhere.

I am using the Java bindings and have a pub/sub socket arrangement. My 
subscriber listens with recv() in its own thread, blocking when there is no 
data. My question is how do I cleanly terminate the blocked subscriber when the 
subscription is no longer needed?

I understand from the docs that a context is thread-safe, but sockets have 
thread-affinity. So I assume that I shouldn't call close() on the socket from 
another thread to break the blocked call. The only solution I've found so far 
is to call term() on the context. This works, but means I have to have a 
separate context for each subscriber which I don't think is what's intended.

What is the proper pattern for this?

Thanks,
Jon Rowland
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to