According to the 0MQ guide, an XSUB-XPUB broker can access the (otherwise hidden) messages related to topic subscriptions by consumers in this scenario:
many publishers (UP) ---> XSUB|broker|XPUB ---> many subscribers (DOWN)
( publications --> )
( <-- topic subscriptions )
But, if topic filtering is not needed (all messages sent to all recipients), then, the SUB-PUB sockets may be used for the broker:
many publishers ---> SUB|broker|PUB ---> many subscribers
Anyway. Suppose that XSUB-XPUB sockets are used. XSUB publications are forwarded down to XPUB (just as in the SUB-PUB broker version) to reach the consumers.
But now, in the XSUB-XPUB broker version you can listen to "upward topic subscriptions" messages (You can't do that with a SUB-PUB broker).
Thanks
After making a proof of concept program.
Answer to 1). Yes it is right. At the broker, remember to do
subSocket.bind( "tcp://*:5001" ) // publishers connect to broker endpoint
subSocket.subscribe( "" )
in order to get in all messages from all publishers.
Answer to 2) Subscription filtering is effectively done by XPUB and PUB sockets.
The reason for using a XSUB-XPUB socket pair is to forward topic subscriptions (coming into the proxy from XPUB) up to the publishers (through XSUB), so the broker only gets messages for topics of interest to any of its subscribers.
Hence, by using a XSUB-XPUB proxy versus a SUB-PUB proxy, you save messages from publishers to the proxy. In both cases, the traffic from proxy to subscribers is the same.
Because the code of a XSUB-XPUB proxy is trivial, there is not reason not to use this combination.