[zeromq-dev] Is custom HWM behaviour possible?
fabien.ninoles at ubisoft.com
Fri May 13 00:10:40 CEST 2011
> I've been playing with zmq and its great, I want to use it to enable our 5
> servers to push out logging messages to a log server to store it
> centrally. Some people would set the 5 servers up as publishers with the
> log server as a subscriber, but that requires the log server to know where
> all the other servers are, whereas I'd rather have it the other way round.
All socket types can both bind and connect, even on the same socket. So,
just connect your PUB loggers to a well known SUB log server. And, why not
also bind some ports so that you can connect a log client to listen to only
this server at the same time ?
Here a small sample of this code in python:
>>> import zmq
>>> context = zmq.Context()
>>> logger = zmq.Socket(context, zmq.PUB)
>>> logserver = zmq.Socket(context, zmq.SUB)
>>> logclient = zmq.Socket(context, zmq.SUB)
>>> logserver.setsockopt(zmq.SUBSCRIBE, '')
>>> logclient.setsockopt(zmq.SUBSCRIBE, '')
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev