[zeromq-dev] [PATCH] Publisher side filtering

Gerard Toonstra gtoonstra at gmail.com
Tue Feb 1 10:06:39 CET 2011


Hi Martin,

The zmq_forwarder uses PUB and SUB sockets by default. I couldn't reproduce
it with those types of sockets, because the PUB socket
doesn't have a "recv" function.

-=-=-=-=

I modified the zmq_forwarder.cpp to use XPUB and XSUB instead and commented
the setsockopt option there as follows:

    zmq::socket_t in_socket (ctx, ZMQ_XSUB);
//    in_socket.setsockopt (ZMQ_SUBSCRIBE, "", 0);
    zmq::socket_t out_socket (ctx, ZMQ_XPUB);

recompiled and ran that.

-=-=-=-=

In your "recv.cpp", I gave the topic a name:

const char *TOPIC = "Special.Topic";

    s.setsockopt (ZMQ_SUBSCRIBE, TOPIC, strlen( TOPIC ));

recompiled and ran that as well.

-=-=-=-=

Same results: tcp      176      0 127.0.0.1:39967
127.0.0.1:5555
ESTABLISHED

(un)subscription received!
(un)subscription received!
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
sent message
(un)subscription received!
(un)subscription received!
(un)subscription received!
(un)subscription received!
(un)subscription received!
(un)subscription received!
(un)subscription received!


The best chance of reproducing this:

- Get a couple of recv processes running and leave them running.
- Get one "send" process running and leave this running the entire time.
- Restarting the zmq_forwarder now may produce different results. Sometimes
it will just work correctly
   ( send prints the subscription received ), sometimes the "send" process
does not print anything.

When nothing is being printed, restart a recv process a couple of times. the
recvQ will build up.

Rgds,

G>


On Mon, Jan 31, 2011 at 10:32 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:

> Gerard,
>
> I am having problem reproducing the behaviour you are seeing.
>
> I am attaching my test programs (publisher, subscriber and the
> configuration file for forwarder device).
>
> Are you able to reproduce the behaviour using those three?
>
> If so, how?
>
> Martin
>
>


-- 
Gerard Toonstra
-----------------------
http://www.radialmind.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110201/e8ce9767/attachment.htm>


More information about the zeromq-dev mailing list