[zeromq-dev] java server (DEALER) + worker / c client (REQ)
davisford at gmail.com
Thu Sep 27 17:40:10 CEST 2012
Hi, I'm trying to get some variation of a DEALER / REQ pattern, where the
server (in java) dispatches messages to worker threads.
Similar to the example here (Java) => http://zguide.zeromq.org/java:tripping
Same example here (C) => http://zguide.zeromq.org/c:tripping
Except I have a Java server with workers and a C client.
My code is here: http://pastebin.com/K483HAJY
The C client will connect to the frontend socket and does a synchronous
write, the write is received, the address frame popped off, and a new
address frame is pushed on for the backend worker. The backend worker
thread receives the msg, it pops off the address frame and pushes on a new
"C" identity frame, and tries to send to the frontend socket.
Unfortunately, the client never receives a reply. I had thought that if I
void *client = = zsocket_new(ctx, ZMQ_REQ);
Then this would have the effect of pushing an identity frame on all
outgoing messages on that socket, which should be the "C" character, but if
I print the messages on the server side, this is what I see:
waiting to receive on frontend...got a message on frontend...
popped address frame: *00800041A7*
pushed 'W' address frame and sending to backend..
received message on worker:org.zeromq.ZMsg at 5db0531
waiting to receive on backend...got a message on backend...
popped address frame: W
pushed 'C' address frame and sending to frontend..
It seems the address frame coming in on the client is some random number,
not "C", so I'm guessing this is why the client never receives a response.
What am I doing wrong?
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev