Package zmq

Examples of zmq.Msg.data()


        sock.sendMore("OFFSET");
        sock.send(ByteBuffer.allocate(8).putLong(-2).array());

        Msg status = sock.base().recv(0);
        assertTrue(status.hasMore());
        assertEquals(100, status.data()[0]);

        Msg oldest = sock.base().recv(0);
        assertFalse(oldest.hasMore());
        assertEquals(infos[0].start(), oldest.buf().getLong());
View Full Code Here


        sock.sendMore("FETCH");
        sock.sendMore(ByteBuffer.allocate(8).putLong(last.start()).array());
        sock.send(ByteBuffer.allocate(8).putLong(Integer.MAX_VALUE).array());

        Msg status = sock.base().recv(0);
        assertEquals(100, status.data()[0]);

        Msg result = sock.base().recv(0);
        assertEquals((int) (last.offset() - last.start()), result.size());

        Iterator<Msg> it = new MsgIterator(result.buf(), false);
View Full Code Here

        while (it.hasNext()) {
            Msg header = it.next();
            if (it.hasNext()) {
                Msg data = it.next();
                result.add(new Message(header.data(), data.data()));
            } else
                break;
        }

        return result;
View Full Code Here

                break;
            more = msg.hasMore();

            switch (state) {
            case START:
                byte[] id = msg.data();
                if (id == null)
                    break;
                topic = ZPUtils.getTopic(id);
                state = TOPIC;
                zlog = logMgr.get(topic);
View Full Code Here

                    break;
                topic = ZPUtils.getTopic(id);
                state = TOPIC;
                zlog = logMgr.get(topic);

                worker.sendMore(msg.data());
                args.clear();
                break;

            case TOPIC:
View Full Code Here

            case TOPIC:

                if (msg.size() == 0 && more) { // bottom
                    state = COMMAND;
                    worker.sendMore(msg.data());
                    break;
                }

            case COMMAND:
View Full Code Here

                    break;
                }

            case COMMAND:

                command = new String(msg.data());
                state = ARGUMENT;
                break;

            case ARGUMENT:
View Full Code Here

                break;
            more = msg.hasMore();

            switch (state) {
            case START:
                byte[] id = msg.data();
                if (id == null)
                    break;
                flag = id[1];
                topic = ZPUtils.getTopic(id);
                if (topic == null) {
View Full Code Here

                if (msg.size() == 0 && more) { // bottom
                    state = COUNT;

                    if (flag > 0)
                        response.add(msg.data());
                    break;
                }

            case COUNT:
View Full Code Here

                }

            case COUNT:

                if (decoder) {
                    count = ByteBuffer.wrap(msg.data()).getInt();
                    state = MESSAGE;
                    break;
                }
                else {
                    state = SINGLE;
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.