Do zmq subscribers know to skip subsequent parts of filtered topics for multipart messages?

32 views Asked by At

Say I have a publisher_socket and a subscriber_socket, created in two different processes. The publisher_socket publishes a two-part message, outlined in pseudo-code below.

publisher_socket.send("huge_blob", ZMQ_SNDMORE)
publisher_socket.send([ 1GB buffer of data ])

Suppose thesubscriber_socket is not set up its message filter to subscribe to the topic "huge_blob". Does the associated background thread know to skip ingestion of the second part of the message? Or might I see the subscriber's memory usage shoot up to 1GB as the background thread copies the second part of the message from the network, even though it will never be used?

1

There are 1 answers

1
jamesdillonharvey On BEST ANSWER

from zeromq v3 onwards all subscriptions are filtered on the publisher side. When you subscribe on your ZMQ_SUB socket, the filter information is sent to the ZMQ_PUB socket and filtered there.

So the answer is no, you ZMQ_SUB process, socket, network etc will not see the first or second frame if they are not subscribed to "huge_blob"