Package org.zeromq

Examples of org.zeromq.ZMsg.send()


  public void testZmqDealer() throws Exception {
    final ZMQ.Context context = ZMQ.context(1);
    final ZMQ.Socket socket = context.socket(ZMQ.DEALER);
    socket.connect("tcp://" + serverAddress.getHostName() + ":" + serverAddress.getPort());
    final ZMsg request = ZMsg.newStringMsg("envelope", "", "hello", "world");
    request.send(socket, false);

    final ZMTPIncomingMessage receivedRequest = incomingMessages.take();
    final ZMTPMessage receivedMessage = receivedRequest.getMessage();
    receivedRequest.getSession().getChannel().write(receivedMessage);
View Full Code Here


            case SINGLE:

                if (store(zlog, msg)) {
                    if (flag > 0 && zlog.flushed()) {
                        response.add(new ZFrame(msg.buf().array()));
                        response.send(worker);
                    }
                } else
                    stop = true;
                if (!more)
                    state = START;
View Full Code Here

            case MESSAGE:

                if (store(zlog, count, msg)) {
                    if (flag > 0 && zlog.flushed()) {
                        response.add(getLastFrame(msg.buf().duplicate()));
                        response.send(worker);
                    }
                } else
                    stop = true;
                if (!more)
                    state = START;
View Full Code Here

                ZMsg msg = ZMsg.recvMsg(worker, 0);
                if (msg == null)
                    break;              //  Interrupted
                msg.getLast().print("Worker: ");
                msg.getLast().reset("OK");
                msg.send(worker);

            }
            ctx.destroy();
        }
    }
View Full Code Here

    {
        ZMsg msg = new ZMsg();
        msg.add("CONNECT");
        msg.add(endpoint);

        msg.send(pipe);
        try {
            Thread.sleep(100);   //  Allow connection to come up
        } catch (InterruptedException e) {
        }
    }
View Full Code Here

        {
            if (System.currentTimeMillis() >= pingAt) {
                ZMsg ping = new ZMsg();
                ping.add(endpoint);
                ping.add("PING");
                ping.send(socket);
                pingAt = System.currentTimeMillis() + PING_INTERVAL;
            }
        }

        private long tickless(long tickless)
View Full Code Here

            //  Frame 1 may be sequence number for reply
            String sequenceStr = reply.popString();
            if (Integer.parseInt(sequenceStr) == sequence) {
                reply.push("OK");
                reply.send(pipe);
                request.destroy();
                request = null;
            }
            else
                reply.destroy();
View Full Code Here

                                server.alive = false;
                            }
                            else {
                                ZMsg request = agent.request.duplicate();
                                request.push(server.endpoint);
                                request.send(agent.router);
                                break;
                            }
                        }
                    }
                }
View Full Code Here

                    if (msg == null)
                        break; // Interrupted
                    ZFrame address = msg.pop();
                    address.destroy();
                    msg.addFirst(new ZFrame("W"));
                    msg.send(backend);
                }
                if (items.pollin(1)) {

                    ZMsg msg = ZMsg.recvMsg(backend);
                    if (msg == null)
View Full Code Here

                    if (msg == null)
                        break; // Interrupted
                    ZFrame address = msg.pop();
                    address.destroy();
                    msg.addFirst(new ZFrame("C"));
                    msg.send(frontend);
                }
            }
            ctx.destroy();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.