IRC Log


Monday August 2, 2010

[Time] NameMessage
[03:23] indygreg I have a client-server model where a stateless server receives a request from a client. But instead of a single response message, I'd like the server to send multiple response messages. I'm seeking advice for the best way to do this in 0MQ.
[03:24] indygreg I tried ZMQ_REP/ZMQ_REP sockets with sending a multipart response message, but it appears the message parts are being buffered
[03:25] indygreg as far as I can tell, the only other solution is to open a new PUB socket on the server and instruct the client how to connect to it. is there a better way?
[05:43] sustrik indygreg: use XREQ/XREP sockets
[05:51] sustrik even better, use multi-part messages
[05:53] indygreg sustrik: I was using multi-part messages but it appears the entire message is being buffered. I'm looking to send a long-running (over hours) stream of messages
[05:53] sustrik then use XREQ/XREP
[05:55] indygreg I'm relatively new to 0MQ - is there documentation on XREQ/XREP vs REQ/REP? I've seen them mentioned here and there but can't find a concise description
[05:56] sustrik nope, the documentation is missing yet
[05:56] sustrik xreq/xrep is similar to req/rep but doesn't require strictly alternate sequence of reqs and reps
[05:57] sustrik otoh, you'll have to do a bit of routing by hand
[05:57] indygreg ahh - sounds just what I'm looking for
[05:57] sustrik REQ socket prepends an empty message part (bottom of the backtrace stack) to each message you send. It also removes the empty message part from the beginning of each message you receive.
[05:57] sustrik REP socket stores all the message parts up to the first empty message part when you receive and passes the rest to the user. When message is sent, it prepends the saved backtrace stack to the message.
[05:57] sustrik XREQ does basically nothing but load balances the sent messages and fair queues the received messages.
[05:57] sustrik XREP prepends a message part containing peer's identity to each received message. It also chops of the first message part from every sent message and uses that as a routing info to find out which peer the message should be sent to.
[05:58] indygreg interesting. I'll definitely take a look. thanks for the pointer
[06:54] indygreg well, that was easy: just capture the first message part of a XREQ request and send it out as the first message part in the response
[06:59] sustrik yes
[16:13] Balistic Can one create a SUB socket, then bind it and have a PUB socket connect to it?
[16:26] sustrik yes
[16:27] Balistic hmm, so far I cant get it to work. Having a SUB connecting to a PUB works fine, but not the other way round.
[16:27] sustrik ?
[16:27] sustrik what's goign wrong?
[16:28] Balistic recv() on the SUB side never returns, even though I can see the packets of messages via wireshark
[16:29] sustrik is that on TCP?
[16:29] Balistic yea
[16:29] Balistic btw, this is with pyzmq also
[16:29] sustrik have you subscribed btw?
[16:29] Balistic yea, to ''
[16:29] Balistic ie emtpy string
[16:30] sustrik strange
[16:30] sustrik report it as a bug then
[16:30] Balistic ill try with the c lib and see if it does the same
[16:30] sustrik please, do
[16:30] sustrik when reporting the bug, attach your test prog
[16:31] Balistic anycase, what im trying todo is write a basic 'hub' that will relay messages of clients to each other. there isnt anything like that atm?
[16:34] sustrik check the zmq_forwarder device
[16:34] Balistic i saw it, but there are little docs for it
[16:34] sustrik http://github.com/zeromq/zeromq-chat/blob/master/README
[16:35] Balistic heh, i think ill go read the source also
[16:36] sustrik have a look :)
[16:36] Balistic ta
[16:36] sustrik it's ~5 lines long :)
[17:27] Balistic sustrik: found my problem. my sender would exit immediatly after doing .send(). adding a slight delay before exiting solved the problem
[23:27] zmqserverQ HI
[23:27] zmqserverQ where is zmq_server?i can find it
[23:27] zmqserverQ thinks