[zeromq-dev] Adding new zmq_getsockopt() to retrieve number of subscriptions from XPUB socket

Francesco francesco.montorsi at gmail.com
Tue Nov 29 15:22:20 CET 2022


Hi everybody,

just for the sake of mailing list history: the feature has been merged
in master (thanks Luca!) and the new socket option is named
ZMQ_TOPICS_COUNT. It can be used against both PUB and SUB sockets and
I think is very useful for debugging purposes.

Thanks,
Francesco


Il giorno ven 18 nov 2022 alle ore 16:14 Francesco
<francesco.montorsi at gmail.com> ha scritto:
>
> Hi everybody,
>
> A PR implementing this idea (ZMQ_SUBSCRIPTION socket option) is now
> available here:
>   https://github.com/zeromq/libzmq/pull/4459
>
> Any comment is appreciated,
>
> thanks,
> Francesco
>
>
>
> Il giorno mer 16 nov 2022 alle ore 16:10 Bill Torpey
> <wallstprog at gmail.com> ha scritto:
> >
> > Hi Francesco:
> >
> > Just to be clear, I’m not a maintainer, just an interested party.  (At my day job I created https://github.com/nyfix/OZ which powers https://www.broadridge.com/financial-services/capital-markets/trading-and-connectivity/order-routing-network).  I believe that Luca is currently the main person responsible for the repo.
> >
> > As for your proposed PR, anything that provides more visibility to what is going on “under the hood” with ZeroMQ is A Good Thing, I think.
> >
> > Regards,
> >
> > Bill
> >
> > On Nov 16, 2022, at 6:54 AM, Francesco <francesco.montorsi at gmail.com> wrote:
> >
> > Hi Bill,
> > ok thanks, sure. I can prepare such PR... I just wanted to get a
> > feedback from other maintainers... I think PRs are mostly reviewed and
> > merged by Luca at this point right?
> >
> > Luca,
> > what do you think about my proposal of new getsockopt to get number of
> > actual subscriptions?
> > Example usage:
> >
> > /* Retrieve number of subscriptions */
> > int subscriptions;
> > size_t subscriptions_size = sizeof (subscriptions);
> > rc = zmq_getsockopt (socket, ZMQ_SUBSCRIPTION_COUNT, &subscriptions,
> > &subscriptions_size );
> >
> > // NOTE: ZMQ_SUBSCRIPTION_COUNT would be applicable only to XPUB, PUB,
> > XSUB, SUB socket types
> >
> >
> > Thanks,
> > Francesco
> >
> >
> > PS: I think it would be nice to have visibility about subscriptions
> > added/removed also on the socket monitor... but that's a lot of more
> > detailed information... I think the basic use case is just to get the
> > whole number of subscriptions (for debugging you often know how many
> > subscriptions were sent and it's useful to check if any subscription
> > has been dropped for some reason)
> >
> >
> >
> > Il giorno mer 16 nov 2022 alle ore 01:32 Bill Torpey
> > <wallstprog at gmail.com> ha scritto:
> >
> >
> > Sorry Francesco — I meant your PR, I just mixed up the names.
> >
> > B.
> >
> > On Nov 15, 2022, at 5:01 PM, Francesco <francesco.montorsi at gmail.com> wrote:
> >
> > Hi Bill,
> >
> > Arnaud’s PR sounds useful — more visibility can only be a good thing.
> >
> >
> > sorry I'm missing which PR you are talking about... is there an
> > existing PR to add more visibility (I'd love that)? Or you're
> > referring to the proposal I did in my first mail?
> >
> > thanks,
> > Francesco
> >
> > Il giorno mar 15 nov 2022 alle ore 22:58 Bill Torpey
> > <wallstprog at gmail.com> ha scritto:
> >
> >
> > The problem with all the socket monitor stuff is that it’s async — that makes it dangerous to act on.  It’s great for monitoring/debugging -- for real-time control not so much.
> >
> > Arnaud’s PR sounds useful — more visibility can only be a good thing.
> >
> > Bill
> >
> > On Nov 15, 2022, at 10:43 AM, Arnaud Loonstra <arnaud at sphaero.org> wrote:
> >
> > On 15-11-2022 15:57, Francesco wrote:
> >
> > Hi zeromq team,
> > For "observability" / debugging I think it would be really really
> > useful to be able to retrieve the number of subscriptions recorded by
> > the 'mtrie_t' object inside a (X)PUB socket.
> > Would you accept a PR adding such option?
> > Thanks,
> > Francesco
> >
> >
> > Isn't that possible through the socket monitor?
> >
> > http://api.zeromq.org/4-1:zmq-socket-monitor
> >
> > Rg,
> >
> > Arnaud
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev


More information about the zeromq-dev mailing list