[zeromq-dev] how to implement the subscriber in the black box pattern
Isaiah Turla
turlaisaiah at gmail.com
Thu Sep 19 09:38:55 CEST 2013
Hi i have this code
context = zmq.Context()
app_worker = context.socket(zmq.PUSH)
app_worker.bind("tcp://127.0.0.1:9005")
app_sub = context.socket(zmq.SUB)
app_sub.connect("tcp://127.0.0.1:9004")
app_sub.setsockopt(zmq.SUBSCRIBE,'JULES')
while True:
msg = app_sub.recv()
msg_data = msg.split(' ',1)
app_worker.send_json(msg_data[1])
print msg_data[1]
but when i run this, it is unable to receive any message from the
publisher, but when i remove the lines,
app_worker = context.socket(zmq.PUSH)
app_worker.bind("tcp://127.0.0.1:9005")
it works normally, but i need it to be able to subscribe then process the
message and then push it to another socket.
what am i doing wrong?
Isaiah Edward G. Turla
BS Computer Science
University of the Philippines Diliman
Activities Committee Head - UP CURSOR
turlaisaiah at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130919/a540c056/attachment.htm>
More information about the zeromq-dev
mailing list