[zeromq-dev] Check if forwarder is running
Cornelius Toole
cornelius.toole at gmail.com
Tue Mar 20 18:44:57 CET 2012
I forked and edited the gist with my changes and comments. I'm not really sure what's wrong, but you may be having a scope problem: https://gist.github.com/2138347
http://stackoverflow.com/questions/423379/using-global-variables-in-a-function-other-than-the-one-that-created-them
incoming, outgoing and context are visible within the termSignalHandler function, you need to add a global statement at the beginning of your function definitions, like so:global incoming, outgoing, context
What version of pyzmq, libzmq are you using?
--
Cornelius Toole
Sent with Sparrow (http://www.sparrowmailapp.com)
On Tuesday, March 20, 2012 at 12:13 PM, Ronald Swain wrote:
> Hello Cornelius ,
>
> Thanks again and it will work for sure.
>
> Next and probably last question is why my sockets are not cleaned up in the forwarder, i try something like https://gist.github.com/2132163 but the handler is never fired.
>
> just to inform you i kill the python interpreter to close the forwarder.
>
>
>
> Date: Tue, 20 Mar 2012 10:09:04 -0500
> From: cornelius.toole at gmail.com (mailto:cornelius.toole at gmail.com)
> To: zeromq-dev at lists.zeromq.org (mailto:zeromq-dev at lists.zeromq.org)
> Subject: Re: [zeromq-dev] Check if forwarder is running
>
> Ronald,
>
> > Do i need to close forwarder again and than start after each message sent by the publisher, or can i do something like i can start the forwarder first and next publisher check if the forwarder is running than just leverage the forwarder to send some messages to the subscriber.
> No you just leave the forwarder running. That's the magic of using a forwarder with pub-sub sockets. But you should probably change how the forwarder device is configured. The way I use the forwarder is to have it bind both the incoming and outgoing sockets and then have the producers and consumers connect to the forwarder; that way once the forwarder is running, producer and consumer processes can start and stop without crashing the other.
> See: https://gist.github.com/2136666#comments
>
>
> --
> Cornelius Toole
> Sent with Sparrow (http://www.sparrowmailapp.com)
>
>
> On Tuesday, March 20, 2012 at 4:35 AM, Symbian Projects wrote:
>
> > Hello All,
> >
> > In one of my past threads i got the zmq device forwarder working, now my exact use case is like i have arbitrary no of publishers and subscribers.
> >
> > First i start the ZMQ forwarder device, than i am starting the subscribers and than a single publisher to send the message.
> >
> > My objective is there are no of publishers who should be able to send messages to the connected subscribers, now how this can happen with a FORWARDER.
> >
> > Do i need to close forwarder again and than start after each message sent by the publisher, or can i do something like i can start the forwarder first and next publisher check if the forwarder is running than just leverage the forwarder to send some messages to the subscriber.
> >
> > I hope my question is clear.
> >
> > Thanks a Lot for reply.
> > Ronald
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org (mailto:zeromq-dev at lists.zeromq.org)
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> >
>
>
>
> _______________________________________________ zeromq-dev mailing list zeromq-dev at lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org (mailto:zeromq-dev at lists.zeromq.org)
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120320/2115a5ee/attachment.htm>
More information about the zeromq-dev
mailing list