Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.Packet


                    log.trace("The socket peer is now closed");
                    stop();
                    return;
                }
                else if (answer != null) {
                    Packet packet = (Packet) answer;
                    // we might have just got a packet in but we've already shut down
                    if (closed.get()) {
                        break;
                    }
                    doConsumePacket(packet);
View Full Code Here


    protected void readPacket(LogRecord logRecord, QueueMessageContainer container) {
        if (!logRecord.isCTRL() && !logRecord.isEOB() && logRecord.length > 0) {
            try {
                // TODO for some wierd reason we get an unnecessary long which I'm guessing is the size
                Packet packet = wireFormat.fromBytes(logRecord.data, 2, logRecord.length - 2);
                if (packet instanceof ActiveMQMessage) {
                    container.addMessage((ActiveMQMessage) packet);
                }
                else if (packet instanceof MessageAck) {
                    MessageAck ack = (MessageAck) packet;
View Full Code Here

        return "EmberTransportChannel: " + client;
    }

    public void newMessage(ByteArrayServerClient client, Object msg) {
        byte[] bytes = (byte[]) msg;
        Packet packet = null;
        try {
            packet = wireFormat.fromBytes(bytes);
            doConsumePacket(packet);
        }
        catch (IOException e) {
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(is);
            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

  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

    }

    private void dispatch(UpPacket p) {
        try {
            // Dont dispatch messages until the channel is started..
            Packet packet = toPacket(p);
            log.trace("<<<< SENDING UP <<<< " + packet);
            if (packet != null) {
                doConsumePacket(packet);
            }
        }
View Full Code Here

                    else {
                        log.warn("Failed to perform GET on: " + remoteUrl + " as response was: " + answer);
                    }
                }
                else {
                    Packet packet = getWireFormat().readPacket(new DataInputStream(httpMethod.getResponseBodyAsStream()));
                    if (packet == null) {
                        log.warn("Received null packet from url: " + remoteUrl);
                    }
                    else {
                        doConsumePacket(packet);
View Full Code Here

TOP

Related Classes of org.codehaus.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.