Package org.zeromq.ZMQ

Examples of org.zeromq.ZMQ.Context.socket()


     */
    public static void main (String[] args) {
        Context context = ZMQ.context(1);
        //  Prepare our context and sockets
        Socket frontend  = context.socket(ZMQ.ROUTER);
        Socket backend  = context.socket(ZMQ.ROUTER);
        frontend.bind("ipc://frontend.ipc");
        backend.bind("ipc://backend.ipc");

        int clientNbr;
        for (clientNbr = 0; clientNbr < NBR_CLIENTS; clientNbr++)
View Full Code Here


        public void run()
        {
            Context context = ZMQ.context(1);

            //  Prepare our context and sockets
            Socket client  = context.socket(ZMQ.REQ);
            ZHelper.setId (client);     //  Set a printable identity

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

            //  Send request, get reply
View Full Code Here

    {
        public void run()
        {
            Context context = ZMQ.context(1);
            //  Prepare our context and sockets
            Socket worker  = context.socket(ZMQ.REQ);
            ZHelper.setId (worker);     //  Set a printable identity

            worker.connect("ipc://backend.ipc");

            //  Tell backend we're ready for work
View Full Code Here

    public static void main (String[] args) {

        Context context = ZMQ.context(1);
   
        //  Bind to inproc: endpoint, then start upstream thread
        Socket receiver = context.socket(ZMQ.PAIR);
        receiver.bind("inproc://step3");
       
        //  Step 2 relays the signal to step 3
        Thread step2 = new Step2 (context);
        step2.start();
View Full Code Here

public class psenvpub {

    public static void main (String[] args) throws Exception {
        // Prepare our context and publisher
        Context context = ZMQ.context(1);
        Socket publisher = context.socket(ZMQ.PUB);

        publisher.bind("tcp://*:5563");
        while (!Thread.currentThread ().isInterrupted ()) {
            // Write two messages, each with an envelope and content
            publisher.sendMore ("A");
View Full Code Here

     * it easier to start and stop the example. Each thread has its own
     * context and conceptually acts as a separate process.
     */
    public static void main (String[] args) throws Exception {
        Context context = ZMQ.context(1);
        Socket broker = context.socket(ZMQ.ROUTER);
        broker.bind("tcp://*:5671");

        for (int workerNbr = 0; workerNbr < NBR_WORKERS; workerNbr++)
        {
            Thread worker = new Worker();
View Full Code Here

        @Override
        public void run() {

            Context context = ZMQ.context(1);
            Socket worker = context.socket(ZMQ.DEALER);
            ZHelper.setId(worker)//  Set a printable identity

            worker.connect("tcp://localhost:5671");

            int total = 0;
View Full Code Here

{
    public static void main(String[] args) throws Exception {
        Context context = ZMQ.context(1);

        //  Socket to talk to server
        Socket responder = context.socket(ZMQ.REP);
        responder.connect("tcp://localhost:5560");

        while (!Thread.currentThread().isInterrupted()) {
            //  Wait for next request from client
            String string = responder.recvStr(0);
View Full Code Here

     * it easier to start and stop the example. Each thread has its own
     * context and conceptually acts as a separate process.
     */
    public static void main (String[] args) throws Exception {
        Context context = ZMQ.context(1);
        Socket broker = context.socket(ZMQ.ROUTER);
        broker.bind("tcp://*:5671");

        for (int workerNbr = 0; workerNbr < NBR_WORKERS; workerNbr++)
        {
            Thread worker = new Worker ();
View Full Code Here

public class identity {

    public static void main (String[] args) throws InterruptedException {

        Context context = ZMQ.context(1);
        Socket sink = context.socket(ZMQ.ROUTER);
        sink.bind("inproc://example");

        //  First allow 0MQ to set the identity, [00] + random 4byte
        Socket anonymous = context.socket(ZMQ.REQ);
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.