Summary
The current state of message filtering in the PUB/SUB topology relies on Subscriber side filtering of messages. The goal of this topic is to address this inefficiency, specifically the sending of unwanted messages, and determine the best path to a solution(s). At the bottom there is a list of posts to the mailing list regarding this topic.
The most straight forward way to address this may be to simply collect use cases. At least this will provide a simple test for proposed solutions, ie does this solution solve all of these use cases.
Use Cases
Example Use Case: Market Data Quote Server
Topology of this case is a simple Server-Client. One server distributes market data to 5-50 clients each subscribed to 10-1000 topics. Number of topics essentially equals the number of symbols, ie for US equities and equity options ~ 450k with up to 500k msg/sec. The number of clients and subscriptions are just made up to make the case more concrete, but the number of symbols and rate of messages correspond to real market data. One of the interesting things about this case is that while PUB side message filtering at least makes this possible with 0MQ, the implementation I am used to follows an Observer pattern. So there is no filtering required, every topic/symbol has a list of subscribers. Message filtering efficiency will obviously be important, which has been addressed here:
http://www.zeromq.org/whitepapers:message-matching
Questions
- Should the PUB/SUB topology be simply changed to use PUB side filtering or is it better to have multiple types of PUB/SUB topologies? Is PUB side filtering simply inefficient and to be replaced or are there cases where it is preferred, if only because the inefficiencies in some cases are so small that the simplicity of the current implementation is more important?
- How does PUB side filtering compare to using an Observer pattern where every topic has a list of subscribers/listeners?
Mail List Related Posts:
publisher side filtering
http://lists.zeromq.org/pipermail/zeromq-dev/2010-June/004194.html
Wed Jun 30 02:54:25 CEST 2010
Pubsub: matching on the publisher end on TCP sockets
http://lists.zeromq.org/pipermail/zeromq-dev/2010-July/004705.html
Wed Jul 28 18:43:53 CEST 2010
Pub/Sub for data distribution
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/004967.html
Sun Aug 8 17:42:06 CEST 2010
pub/sub topic matching on sender side
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/005023.html
Tue Aug 10 11:07:24 CEST 2010
PUB-SUB filtering question
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/005198.html
Fri Aug 13 17:57:48 CEST 2010
PUB-SUB scalability
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/005248.html
Mon Aug 16 16:44:48 CEST 2010
Publisher Side Filtering Revisited
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/005363.html
Wed Aug 18 18:20:57 CEST 2010
pub matcher again
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/005388.html
Fri Aug 20 18:47:49 CEST 2010
ZMQ_REQ/ZMQ_XREP - FSM = ZMQ_NODE/ZMQ_XNODE?
http://lists.zeromq.org/pipermail/zeromq-dev/2010-August/005389.html
Fri Aug 20 22:35:42 CEST 2010

Hi,
I'm new to ZeroMQ and have a question on the topic of publisher side filtering / authorization. Since most of the messages on this topic are from around 2010, I was wondering if anything new has come up in this area or if any 'patterns' could be used to solve this problem? I know v3.0 and v3.1 move the problem closer to the publisher but I was looking for a more direct solution to the problem below.
I would like to be able to have a client subscribe to everything but limit what is published to them based on their 'role' or access level. I would only want messages which the user was authorized to see to physically go to the users machine. After reading all the posts on publisher side filtering, it seems there is currently no way to do this with ZeroMQ natively. As I understand it, if the user subscribes to everything, they get everything.
One idea would be to allow the publisher to get a list of subscribers (including their subscriber information such as user name, etc.) and to pass a filtered list of subscribers to the publish call. The filtering of subscribers could be based on 'authorization level', 'subscription filter' or both and would be up to the implementer. This would solve the problem of messages flowing to users which were not interested or authorized to see certain messages. It would introduce more CPU use on the publisher which could be a bottleneck but would be optional of course. Just an idea…
Thanks for any advice!