Package org.zeromq.ZMQ

Examples of org.zeromq.ZMQ.Socket.send()


        publisher.bind("tcp://*:5563");
        while (!Thread.currentThread ().isInterrupted ()) {
            // Write two messages, each with an envelope and content
            publisher.sendMore ("A");
            publisher.send ("We don't want to see this");
            publisher.sendMore ("B");
            publisher.send("We would like to see this");
        }
        publisher.close ();
        context.term ();
View Full Code Here


        while (!Thread.currentThread ().isInterrupted ()) {
            // Write two messages, each with an envelope and content
            publisher.sendMore ("A");
            publisher.send ("We don't want to see this");
            publisher.sendMore ("B");
            publisher.send("We would like to see this");
        }
        publisher.close ();
        context.term ();
    }
}
View Full Code Here

            broker.recv(0);     //  Response from worker
            broker.sendMore("");

            //  Encourage workers until it's time to fire them
            if (System.currentTimeMillis() < endTime)
                broker.send("Work harder");
            else {
                broker.send("Fired!");
                if (++workersFired == NBR_WORKERS)
                    break;
            }
View Full Code Here

            //  Encourage workers until it's time to fire them
            if (System.currentTimeMillis() < endTime)
                broker.send("Work harder");
            else {
                broker.send("Fired!");
                if (++workersFired == NBR_WORKERS)
                    break;
            }
        }
View Full Code Here

            int total = 0;
            while (true) {
                //  Tell the broker we're ready for work
                worker.sendMore("");
                worker.send("Hi Boss");

                //  Get workload from broker, until finished
                worker.recvStr();   //  Envelope delimiter
                String workload = worker.recvStr();
                boolean finished = workload.equals("Fired!");
View Full Code Here

            ZHelper.setId (client);     //  Set a printable identity

            client.connect("ipc://frontend.ipc");

            //  Send request, get reply
            client.send("HELLO");
            String reply = client.recvStr ();
            System.out.println("Client: " + reply);

            context.destroy ();
        }
View Full Code Here

            //  Do some 'work'
            Thread.sleep(1000);

            //  Send reply back to client
            responder.send("World");
        }

        //  We never get here but clean up anyhow
        responder.close();
        context.term();
View Full Code Here

            broker.recvStr ();     //  Response from worker
            broker.sendMore ("");

            //  Encourage workers until it's time to fire them
            if (System.currentTimeMillis () < endTime)
                broker.send ("Work harder");
            else {
                broker.send ("Fired!");
                if (++workersFired == NBR_WORKERS)
                    break;
            }
View Full Code Here

            //  Encourage workers until it's time to fire them
            if (System.currentTimeMillis () < endTime)
                broker.send ("Work harder");
            else {
                broker.send ("Fired!");
                if (++workersFired == NBR_WORKERS)
                    break;
            }
        }
View Full Code Here

        //  First allow 0MQ to set the identity, [00] + random 4byte
        Socket anonymous = context.socket(ZMQ.REQ);

        anonymous.connect("inproc://example");
        anonymous.send ("ROUTER uses a generated UUID",0);
        ZHelper.dump (sink);

        //  Then set the identity ourself
        Socket identified = context.socket(ZMQ.REQ);
        identified.setIdentity("PEER2".getBytes ());
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.