Package org.zeromq.ZMQ

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


                backend.sendMore (workerAddr);
                backend.sendMore ("");
                backend.sendMore (clientAddr );
                backend.sendMore ("");
                backend.send (request);

            }
        }

        frontend.close();
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);

            client.close();
            context.term();
View Full Code Here

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

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

            //  Tell backend we're ready for work
            worker.send("READY");

            while(!Thread.currentThread ().isInterrupted ())
            {
                String address = worker.recvStr ();
                String empty = worker.recvStr ();
View Full Code Here

                String request = worker.recvStr ();
                System.out.println("Worker: " + request);

                worker.sendMore (address);
                worker.sendMore ("");
                worker.send("OK");
            }
            worker.close ();
            context.term ();
        }
    }
View Full Code Here

                        String reply = client.recvStr(0);
                        if (reply == null)
                            break;              //  Interrupted
                        //  Worker is supposed to answer us with our task id
                        assert (reply.equals(taskId));
                        monitor.send(String.format("%s", reply), 0);
                    } else {
                        monitor.send(
                                String.format("E: CLIENT EXIT - lost task %s", taskId), 0);
                        ctx.destroy();
                        return;
View Full Code Here

                            break;              //  Interrupted
                        //  Worker is supposed to answer us with our task id
                        assert (reply.equals(taskId));
                        monitor.send(String.format("%s", reply), 0);
                    } else {
                        monitor.send(
                                String.format("E: CLIENT EXIT - lost task %s", taskId), 0);
                        ctx.destroy();
                        return;
                    }
                    burst--;
View Full Code Here

                        this.sendMessage(msg, identity, snapshot);
                    }

                    // now send end message with sequence number
                    System.out.println("Sending state snapshot = " + stateSequence);
                    snapshot.send(identity, ZMQ.SNDMORE);
                    kvsimple message = new kvsimple("KTHXBAI", stateSequence, "".getBytes());
                    message.send(snapshot);
        }
      }
    }
View Full Code Here

        public void run(){
            //  Signal downstream to step 2
            Socket xmitter = context.socket(ZMQ.PAIR);
            xmitter.connect("inproc://step2");
            System.out.println ("Step 1 ready, signaling step 2");
            xmitter.send("READY", 0);
            xmitter.close ();
        }

    }
    private static class Step2 extends Thread
View Full Code Here

            receiver.close ();

            //  Connect to step3 and tell it we're ready
            Socket xmitter = context.socket(ZMQ.PAIR);
            xmitter.connect("inproc://step3");
            xmitter.send("READY", 0);

            xmitter.close ();
        }

    }
View Full Code Here

            publisher.bind("tcp://*:6000");
            Random rand = new Random(System.currentTimeMillis());

            while (!Thread.currentThread().isInterrupted()) {
                String string = String.format("%c-%05d", 'A' + rand.nextInt(10), rand.nextInt(100000));
                if (!publisher.send(string))
                    break;              //  Interrupted
                try {
                    Thread.sleep(100);     //  Wait for 1/10th second
                } catch (InterruptedException e) {
                }
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.