Package org.zeromq

Examples of org.zeromq.ZContext.createSocket()


    {
        System.out.printf(" * kvmsg: ");

        //  Prepare our context and sockets
        ZContext ctx = new ZContext();
        Socket output = ctx.createSocket(ZMQ.DEALER);
        output.bind("ipc://kvmsg_selftest.ipc");
        Socket input = ctx.createSocket(ZMQ.DEALER);
        input.connect("ipc://kvmsg_selftest.ipc");

        Map<String,kvmsg> kvmap = new HashMap<String, kvmsg>();
View Full Code Here


        //  Prepare our context and sockets
        ZContext ctx = new ZContext();
        Socket output = ctx.createSocket(ZMQ.DEALER);
        output.bind("ipc://kvmsg_selftest.ipc");
        Socket input = ctx.createSocket(ZMQ.DEALER);
        input.connect("ipc://kvmsg_selftest.ipc");

        Map<String,kvmsg> kvmap = new HashMap<String, kvmsg>();

        //  .until
View Full Code Here

    public static void main(String[] argv)
    {
        ZContext ctx = new ZContext();
        System.out.println("I: connecting to server");
        Socket client = ctx.createSocket(ZMQ.REQ);
        assert (client != null);
        client.connect(SERVER_ENDPOINT);

        int sequence = 0;
        int retriesLeft = REQUEST_RETRIES;
View Full Code Here

                } else {
                    System.out.println("W: no response from server, retrying\n");
                    //  Old socket is confused; close it and open a new one
                    ctx.destroySocket(client);
                    System.out.println("I: reconnecting to server\n");
                    client = ctx.createSocket(ZMQ.REQ);
                    client.connect(SERVER_ENDPOINT);
                    //  Send request again, on new socket
                    client.send(request);
                }
            }
View Full Code Here

  private static Map<String, kvsimple> kvMap = new HashMap<String, kvsimple>();

  public void run() {
    ZContext ctx = new ZContext();
    Socket snapshot = ctx.createSocket(ZMQ.DEALER);
    snapshot.connect("tcp://localhost:5556");

    Socket subscriber = ctx.createSocket(ZMQ.SUB);
        subscriber.connect("tcp://localhost:5557");
        subscriber.subscribe(SUBTREE.getBytes());
View Full Code Here

  public void run() {
    ZContext ctx = new ZContext();
    Socket snapshot = ctx.createSocket(ZMQ.DEALER);
    snapshot.connect("tcp://localhost:5556");

    Socket subscriber = ctx.createSocket(ZMQ.SUB);
        subscriber.connect("tcp://localhost:5557");
        subscriber.subscribe(SUBTREE.getBytes());

    Socket push = ctx.createSocket(ZMQ.PUSH);
    push.connect("tcp://localhost:5558");
View Full Code Here

    Socket subscriber = ctx.createSocket(ZMQ.SUB);
        subscriber.connect("tcp://localhost:5557");
        subscriber.subscribe(SUBTREE.getBytes());

    Socket push = ctx.createSocket(ZMQ.PUSH);
    push.connect("tcp://localhost:5558");

    // get state snapshot
    snapshot.sendMore("ICANHAZ?");
        snapshot.send(SUBTREE);
View Full Code Here

public class lvcache
{
    public static void main(String[] args)
    {
        ZContext context = new ZContext();
        Socket frontend = context.createSocket(ZMQ.SUB);
        frontend.bind("tcp://*:5557");
        Socket backend = context.createSocket(ZMQ.XPUB);
        backend.bind("tcp://*:5558");

        //  Subscribe to every single topic from publisher
View Full Code Here

    public static void main(String[] args)
    {
        ZContext context = new ZContext();
        Socket frontend = context.createSocket(ZMQ.SUB);
        frontend.bind("tcp://*:5557");
        Socket backend = context.createSocket(ZMQ.XPUB);
        backend.bind("tcp://*:5558");

        //  Subscribe to every single topic from publisher
        frontend.subscribe("".getBytes());

View Full Code Here

    //  The main task is an LRU queue with heartbeating on workers so we can
    //  detect crashed or blocked worker tasks:
    public static void main(String[] args) {
        ZContext ctx = new ZContext ();
        Socket frontend = ctx.createSocket(ZMQ.ROUTER);
        Socket backend = ctx.createSocket(ZMQ.ROUTER);
        frontend.bind( "tcp://*:5555");    //  For clients
        backend.bind( "tcp://*:5556");    //  For workers

        //  List of available workers
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.