Search code examples
zeromqpublish-subscribedistributed-system

ZeroMQ can subscribe, but how to exclude a specific filter?


In ZeroMQ we can subscribe to a topic, with some filter

socket.setsockopt(zmq.SUBSCRIBE, "/someRoot/")

Is there a way to exclude a specific filter from being sent?

For example, how can we exclude "/someRoot/noise/" from being sent?

Sure, we can check for it on a subscriber side, but I would like to avoid it from being even sent to this subscriber in the first place...

Is this possible with ZeroMQ?


Solution

  • If I got your point of view correctly, yes, that is pretty possible using ZeroMQ tools, just:

    create a CensorProxy ( a Man-In-The-Middle pattern )

    and assemble a client-XSUB/XPUB-[MITM-PolicyMaker]-SUB/PUB pipeline, where MITM-Censor will implement the policies, what is allowed to subscribe to and what is not.

    Hope this helps more the good boys side than the bad boys side.