Package org.zeromq.ZMQ

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


        Context ctx = ZMQ.context(1);
        Socket router = ctx.socket(ZMQ.ROUTER);
        router.bind("tcp://127.0.0.1:6002");
        router.setEncoder(Persistence.PersistEncoder.class);

        Socket dealer = ctx.socket(ZMQ.DEALER);
        dealer.setIdentity("A".getBytes());
        dealer.connect("tcp://127.0.0.1:6002");

        Thread.sleep(1000);
        router.sendMore("A");
View Full Code Here


        raf.close();
        ch.close();

        Context ctx = ZMQ.context(1);
        Socket router = ctx.socket(ZMQ.ROUTER);
        router.bind("tcp://127.0.0.1:6003");
        router.setEncoder(Persistence.PersistEncoder.class);

        Socket dealer = ctx.socket(ZMQ.DEALER);
        dealer.setIdentity("A".getBytes());
View Full Code Here

        Context ctx = ZMQ.context(1);
        Socket router = ctx.socket(ZMQ.ROUTER);
        router.bind("tcp://127.0.0.1:6003");
        router.setEncoder(Persistence.PersistEncoder.class);

        Socket dealer = ctx.socket(ZMQ.DEALER);
        dealer.setIdentity("A".getBytes());
        dealer.connect("tcp://127.0.0.1:6003");

        Thread.sleep(1000);
        router.sendMore("A");
View Full Code Here

    @Test
    public void testSend() throws Exception
    {
        Context ctx = ZMQ.context(1);
        Socket sock = ctx.socket(ZMQ.DEALER);

        ZLog zlog = ZLogManager.instance().get(topic);
        long offset = zlog.offset();
        String data = "hello";
View Full Code Here

    @Test
    public void testSendPush() throws Exception
    {
        Context ctx = ZMQ.context(1);
        Socket sock = ctx.socket(ZMQ.PUSH);

        ZLog zlog = ZLogManager.instance().get(topic);
        long offset = zlog.offset();
        String data = "hello";
View Full Code Here

   
    public static void main (String[] args) {

        Context context = ZMQ.context(1);

        Socket clients = context.socket(ZMQ.ROUTER);
        clients.bind ("tcp://*:5555");

        Socket workers = context.socket(ZMQ.DEALER);
        workers.bind ("inproc://workers");

View Full Code Here

        Context context = ZMQ.context(1);

        Socket clients = context.socket(ZMQ.ROUTER);
        clients.bind ("tcp://*:5555");

        Socket workers = context.socket(ZMQ.DEALER);
        workers.bind ("inproc://workers");

        for(int thread_nbr = 0; thread_nbr < 5; thread_nbr++) {
            Thread worker = new Worker (context);
            worker.start();
View Full Code Here

    public static void main(String[] argv) throws Exception
    {
        Random rand = new Random(System.nanoTime());

        Context context = ZMQ.context(1);
        Socket server = context.socket(ZMQ.REP);
        server.bind("tcp://*:5555");

        int cycles = 0;
        while (true) {
            String request = server.recvStr();
View Full Code Here

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

        //  Socket to talk to server
        Socket requester = context.socket(ZMQ.REQ);
        requester.connect("tcp://localhost:5559");
       
        System.out.println("launch and connect client.");

        for (int request_nbr = 0; request_nbr < 10; request_nbr++) {
View Full Code Here

public class clonecli2 {
  private static Map<String, kvsimple> kvMap = new HashMap<String, kvsimple>();

  public void run() {
    Context ctx = ZMQ.context(1);
    Socket snapshot = ctx.socket(ZMQ.DEALER);
    snapshot.connect("tcp://localhost:5556");

    Socket subscriber = ctx.socket(ZMQ.SUB);
    subscriber.connect("tcp://localhost:5557");
    subscriber.subscribe("".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.