Package org.activemq.message

Examples of org.activemq.message.Packet


        assertTextMessage(expected, (ActiveMQTextMessage) actual);
    }

    public void testObjectMessage() throws Exception {
        ActiveMQObjectMessage expected = createObjectMessage();
        Packet actual = writeThenReadPacket(expected);
        assertObjectMessage(expected, (ActiveMQObjectMessage) actual);
    }
View Full Code Here


        assertObjectMessage(expected, (ActiveMQObjectMessage) actual);
    }

    public void testMapMessage() throws Exception {
        ActiveMQMapMessage expected = createMapMessage();
        Packet actual = writeThenReadPacket(expected);
        assertMapMessage(expected, (ActiveMQMapMessage) actual);
    }
View Full Code Here

    }

    protected Packet writeThenReadPacket(ActiveMQMessage expected) throws IOException, JMSException {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        wireFormat.writePacket(expected, new DataOutputStream(buffer));
        Packet actual = wireFormat.readPacket(createDataIn(buffer));
        return actual;
    }
View Full Code Here

                    ThreadedExecutor exec = new ThreadedExecutor();
                    exec.execute(new Runnable() {
                        public void run() {
                            while (!closed.get()) {
                                try {
                                    Packet packet = bpq.dequeue();
                                    if (packet != null) {
                                        dispatchToClient(packet);
                                    }
                                }
                                catch (InterruptedException e) {
View Full Code Here

    public void testSendPacket() throws Exception {
        System.out.println("Sending packets");

        List tmpList = (List) packets.clone();
        for (int i = 0; i < TEST_SIZE; i++) {
            Packet packet = (Packet) tmpList.get(i);
            sender.asyncSend(packet);
        }
        System.out.println("Sent: " + TEST_SIZE + " packets");

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

        assertTrue("Exceptions were thrown: " + exceptions, exceptions.size() == 0);
    }

    public void testAsyncSendWithReceipt() throws Exception {
        sendReceipts = true;
        Packet packet = new KeepAlive();
        packet.setId((short) 1);
        ReceiptHolder rh = sender.asyncSendWithReceipt(packet);
        Receipt result = rh.getReceipt(5000);
        if (result == null) {
            fail("Should have gotten receipt");
        }
View Full Code Here

    public void testRpc() throws Exception {
        sendReceipts = true;

        List tmpList = (List) packets.clone();
        for (int i = 0; i < TEST_SIZE; i++) {
            Packet packet = (Packet) tmpList.get(i);
            Receipt receipt = sender.send(packet, 4000);
            assertTrue("Receipt should not be null!", receipt != null);
            System.out.println("Got receipt: " + receipt + " for packet: " + packet);
        }
    }
View Full Code Here

            byte type = is.readByte();
            if (type != PACKET_RECORD_TYPE) {
                throw new IOException("Record is not a packet type.");
            }
            String destination = is.readUTF();
            Packet packet = wireFormat.readPacket(data);
            is.close();
            return packet;

        }
        catch (InvalidRecordLocationException e) {
View Full Code Here

            org.activeio.Packet data = journal.read(pos);
            DataInputStream is = new DataInputStream(new PacketInputStream(data));

            // Read the destination and packate from the record.
            String destination = null;
            Packet packet = null;
            try {
                byte type = is.readByte();
                switch (type) {
                    case PACKET_RECORD_TYPE:
View Full Code Here

        }
        return data;
    }
   
    protected Packet readPacket(DataInput dataIn, PacketReader reader) throws IOException {
        Packet packet = reader.createPacket();
        int length = dataIn.readInt();
        packet.setMemoryUsage(length);
        reader.buildPacket(packet, dataIn);
        return packet;
    }
View Full Code Here

TOP

Related Classes of org.activemq.message.Packet

Copyright © 2018 www.massapicom. 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.