Hi there,

I would like to use ZMQ in order to connect several processes  that are 
publishing messages and one that is receiving the messages.
I am having problem creating subscribe code.

The publish code for one process looks like this:

using ZMQ

zmq_tcp ="tcp://*:5554"
zmq_ctx = Context(1)
zmq_socket = Socket(zmq_ctx, PUB)
ZMQ.bind(zmq_socket, zmq_tcp)
while true
    msg = "aaa"
    ZMQ.send(zmq_socket, Message(msg))
    println("Publish: ", msg)
end

I found python example 
(http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pubsub.html)
 
but I am not able to find corresponding Julia calls.

Subscriber code should be something like this:

using ZMQ

zmq_tcp1 ="tcp://localhost:5553"
zmq_tcp2 ="tcp://localhost:5554"
zmq_ctx = Context(1)
zmq_socket = Socket(zmq_ctx, SUB)
zmq_socket.connect (zmq_tcp1)
zmq_socket.connect (zmq_tcp2)

while true
   println("Waiting")
   msg = bytestring(ZMQ.recv(zmq_socket))
   println(msg)

end
 

Thanks,

Dejan

Reply via email to