On Tue, Dec 4, 2012 at 8:38 PM, Adrian Ribao <ari...@gmail.com> wrote:
>
> ----
> context = zmq.Context()
> print "Starting the proxy..."
>
> # Listen for events
> sub = context.socket(zmq.SUB)
> sub.bind("tcp://*:5555")
> sub.setsockopt(zmq.SUBSCRIBE, '')
>
> # Emit events
> pub = context.socket(zmq.PUB)
> pub.bind("tcp://*:5556")
>
> while True:
>     message = sub.recv()
>     pub.send(message)
> ----
>
>
Very common use of a proxy to be the stable part in an architecture, to
allow publishers and consumers to come and go. If you look in the python
bindings you'll see support for devices or proxies (old name / new name)
which actually do what you've written, but slightly more optimised, with
support for multipart messages. You've got the gist though.

Ian
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to