Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get a list of filters from a ZeroMQ PUB-socket?

As stated in the docs in version 3.x of zeromq in PUB/SUB scenarios messages are being filtered on publisher side (rather than on subscriber side which is trivial).

To me this sounds like that the publisher has to hold a list of all connected sockets and message filters to accomplish this.

Would you agree?

Based on this assumption I'd now like to know whether or not a specific filter is active or not. This would make it possible for me to not retrieve specific data from some (maybe very slow) other data provider when I know it's not being used anyway.

Is there a way to see what filters are active on a given PUB socket in a recent version of ZeroMQ?

I know there already has been some work on this, see here but that's been two years now..

like image 712
frans Avatar asked Oct 19 '22 03:10

frans


1 Answers

So far as I know, there's no way to get this information from ZMQ. If you want the most up-to-date information on this, the best place to ask would be the ZMQ dev mailing list, the actual developers are over there.

Looking a little further back, I found this discussion on the mailing list that, while it doesn't speak specifically about subscriber topics, does address why that information isn't available - namely, that knowing a subscriber is subscribed to a topic means knowing that they're connected, and that information goes against the ZMQ abstraction design concept of letting connections/disconnections be more seamless.

There is a solution, just probably not the one you're looking for: spin up another pair of meta-sockets to communicate from client to server what topics it is interested in, so this information goes from ZMQ abstraction into explicit message passing. You keep track of that info there and use it to control your information gathering. It may seem a bit of a kludge (when the information is already technically there in the publisher, as you note), but it's the ZMQ way of doing things.

like image 91
Jason Avatar answered Oct 28 '22 17:10

Jason