Package org.activemq.message

Examples of org.activemq.message.Packet


        return packet;
    }


    protected Packet readPacket(DataInput dataIn, AbstractPacketMarshaller marshaler) throws IOException {
        Packet packet = marshaler.createPacket();
        marshaler.buildPacket(packet, dataIn);
        return packet;
    }
View Full Code Here


     * @throws IOException
     */
    public Packet readPacketFromByteArray(byte[] data) throws IOException {
        ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
        DataInputStream dataIn = new DataInputStream(bytesIn);
        Packet packet = createPacket();
        buildPacket(packet, dataIn);
        return packet;
    }
View Full Code Here

                log.trace("Discarding packet from id: " + id);
            }
            return null;
        }
        int type = in.readByte();
        Packet packet = readPacket(type, in);
        //        if (packet instanceof ActiveMQMessage) {
        //            System.out.println("##### read packet from channel: " + id + " in channel: " + channelID + " message: " +
        // 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

    protected AbstractPacketMarshaller marshaller;
    protected OpenWireFormat wireformat = new OpenWireFormat();
    protected File directory = new File("target/sample-data");

    public void testCreateThenWriteToFileThenReadBack() throws Exception {
        Packet packet = marshaller.createPacket();
        populatePacket(packet);
        assertPacketValid(packet);

        // now lets write it to a file
        File file = new File(directory, marshaller.getClass().getName() + ".sample");
View Full Code Here

    }


    public Packet readPacket(DataInput in) throws IOException
    {
        Packet pending = (Packet) AsyncHelper.tryUntilNotInterrupted(new AsyncHelper.HelperWithReturn()
        {
            public Object cycle() throws InterruptedException
            {
                return pendingReadPackets.poll(0);
            }
View Full Code Here

                            returnPackets.add(createConnectionInfo());
                            returnPackets.add(createConsumerPacket());
                        }
                    }   
                }else if (name.equals(MESSAGE_QNAME)){
                    Packet pack = readMessage(reader);
                    if (pack != null){
                        returnPackets.add(pack);
                    }
                }else {
                    //general catch all - just say ok ..
View Full Code Here

        return null;
    }

    protected synchronized final Packet readPacket(DataInput dataIn, PacketReader reader) throws IOException {
        synchronized (readMutex) {
            Packet packet = reader.createPacket();
            int length = dataIn.readInt();
            packet.setMemoryUsage(length);
            byte[] data = new byte[length];
            dataIn.readFully(data);
            //then splat into the internal datainput
            internalBytesIn.restart(data);
            reader.buildPacket(packet, internalDataIn);
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

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.