[zeromq-dev] PyZMQ PushHandler?

MinRK benjaminrk at gmail.com
Sat Apr 14 03:15:23 CEST 2012


For reference:

The first argument to PUBHandler is *either* a zmq url-string (e.g.
'tcp://127.0.0.1:5555'), in which case the handler will create and bind a
PUB socket, or it is an already configured socket.  If you bind and/or
connect a PUSH socket, then you will have your PUSHHandler:

push = ctx.socket(zmq.PUSH)
push.connect(sink_url)

handler = PUBHandler(push)
logger.addHandler(handler)

  This would also be the way to use a PUB socket that connects instead of
binds, or binds to more than one interface, etc.

-MinRK

On Tue, Apr 10, 2012 at 16:27, Bill Lubanovic <bill at madscheme.com> wrote:

> Thanks, Michel.  That would handle the fan-in, but I'd need to relay
> from a single bound SUB to another PUB, or have multiple bound SUBs as
> you suggest.  In my case, I'd like to plug in arbitrary subscribers as
> needed to sip from the firehose, so I think I still need a fan-out
> step.  Then my first step could be connected PUBs to a bound SUB or
> connected PUSHes to a   bound PULL, then relay to a separate bound
> PUB.
>
> On Tue, Apr 10, 2012 at 5:52 PM, Michel Pelletier
> <pelletier.michel at gmail.com> wrote:
> > Or you can change the bind into a connect, and have the subscriber(s)
> > do the bind. Then all your pubs can connect to any number of bound sub
> > endpoints which in turn will receive all pub'ed messages.
> >
> > I have not seen this code in question, so I could be wrong about how
> > it works, but that seems like a simple solution to me that leverages
> > the N-to-N capability of 0mq pub/sub.
> >
> > -Michel
> >
> > On Tue, Apr 10, 2012 at 3:50 PM, Bill Lubanovic <bill at madscheme.com>
> wrote:
> >> PyZMQ includes a PUBHandler to distribute Python logging messages
> >> through a ZMQ PUB socket.  I want to log from applications like web
> >> servers that may have multiple child processes, and the PUB socket
> >> binds to a specific port.  What's a good alternative?  It looks like I
> >> could 1) write a PUSHHandler for each process 2) fanning in to a
> >> well-known PULL socket to collect the messages and pass  them to 3) a
> >> PUB socket to fan out to subscribers.
> >> --
> >> Bill Lubanovic
> >> _______________________________________________
> >> 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
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> --
> Bill Lubanovic
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120413/bc81eeab/attachment.htm 


More information about the zeromq-dev mailing list