Package org.zeromq

Examples of org.zeromq.ZContext.createSocket()


    static class Broker implements Runnable {
        @Override
        public void run() {
            ZContext ctx = new ZContext();
            Socket frontend = ctx.createSocket(ZMQ.ROUTER);
            Socket backend = ctx.createSocket(ZMQ.ROUTER);
            frontend.bind("tcp://*:5555");
            backend.bind("tcp://*:5556");

            while (!Thread.currentThread().isInterrupted()) {
                ZMQ.Poller items = ctx.getContext().poller();
View Full Code Here


    static class Worker implements Runnable {

        @Override
        public void run() {
            ZContext ctx = new ZContext();
            Socket worker = ctx.createSocket(ZMQ.DEALER);
            worker.setIdentity("W".getBytes());
            worker.connect("tcp://localhost:5556");
            while (!Thread.currentThread().isInterrupted()) {
                ZMsg msg = ZMsg.recvMsg(worker);
                msg.send(worker);
View Full Code Here

        private static int SAMPLE_SIZE = 10000;

        @Override
        public void run() {
            ZContext ctx = new ZContext();
            Socket client = ctx.createSocket(ZMQ.DEALER);
            client.setIdentity("C".getBytes());
            client.connect("tcp://localhost:5555");
            System.out.println("Setting up test...");
            try {
                Thread.sleep(100);
View Full Code Here

    public static void main(String[] args) {
        // Prepare our context and sockets
        ZContext context = new ZContext();
        ZMQ.Socket frontend = context.createSocket(ZMQ.ROUTER);
        ZMQ.Socket backend = context.createSocket(ZMQ.ROUTER);
        frontend.bind("tcp://*:5555"); // For clients
        backend.bind("tcp://*:5556"); // For workers
        WorkersPool workers = new WorkersPool();

        while (!Thread.currentThread().isInterrupted()) {
View Full Code Here

    }

    public static void main(String[] args) {
        // Prepare our context and sockets
        ZContext context = new ZContext();
        ZMQ.Socket frontend = context.createSocket(ZMQ.ROUTER);
        ZMQ.Socket backend = context.createSocket(ZMQ.ROUTER);
        frontend.bind("tcp://*:5555"); // For clients
        backend.bind("tcp://*:5556"); // For workers
        WorkersPool workers = new WorkersPool();

View Full Code Here

        System.out.printf (" * fmq_server: ");
        ZContext ctx = new ZContext ();
       
        FmqServer self;
        Socket dealer = ctx.createSocket (ZMQ.DEALER);
        dealer.setReceiveTimeOut (2000);
        dealer.connect ("tcp://localhost:5670");
       
        FmqMsg request, reply;
       
View Full Code Here

        //  Create pair of sockets we can send through
        ZContext ctx = new ZContext ();
        assert (ctx != null);

        Socket output = ctx.createSocket (ZMQ.DEALER);
        assert (output != null);
        output.bind ("inproc://selftest");
        Socket input = ctx.createSocket (ZMQ.ROUTER);
        assert (input != null);
        input.connect ("inproc://selftest");
View Full Code Here

        assert (ctx != null);

        Socket output = ctx.createSocket (ZMQ.DEALER);
        assert (output != null);
        output.bind ("inproc://selftest");
        Socket input = ctx.createSocket (ZMQ.ROUTER);
        assert (input != null);
        input.connect ("inproc://selftest");
       
        //  Encode/send/decode and verify each message type
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.