Package org.activemq.message

Examples of org.activemq.message.Packet


     * @param packet
     * @return a response or null
     * @throws JMSException
     */
    protected Packet doAsyncSend(Packet packet) throws JMSException {
        Packet response = null;
        try {
            synchronized (outboundLock) {
                response = getWireFormat().writePacket(packet, dataOut);
                dataOut.flush();
            }
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

        }
        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

     */
    public void run() {
        try {
            while (!closed.get()) {
                DatagramPacket dpacket = socket.receive();
                Packet packet = wireFormat.readPacket(channelId, dpacket);
                if (packet != null) {
                    doConsumePacket(packet);
                }
            }
            log.trace("The socket peer is now closed");
View Full Code Here

                    else {
                        log.warn("Failed to perform GET on: " + remoteUrl + " as response was: " + answer);
                    }
                }
                else {
                    Packet packet = getWireFormat().readPacket(new DataInputStream(connection.getInputStream()));
                    //Packet packet = getWireFormat().fromString(connection.getContent().toString());
                    if (packet == null) {
                        log.warn("Received null packet from url: " + remoteUrl);
                    }
                    else {
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

                    // lets discard messages coming from the local address
                    // to avoid infinite loops when used with the JMS broker
                    if (!localAddress.equals(message.getSrc())) {
                        byte[] data = message.getBuffer();
                        Packet packet = wireFormat.fromBytes(data);
                        if (packet != null) {
                            doConsumePacket(packet);
                        }
                    }
                }
View Full Code Here

        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // lets return the next response
        Packet packet = null;
        try {
            HttpServerTransportChannel transportChannel = getTransportChannel(request);
            if (transportChannel == null) {
                return;
            }
View Full Code Here

        }
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            Packet packet = wireFormat.fromString(readRequestBody(request));
           
            if( packet.getPacketType() == Packet.WIRE_FORMAT_INFO ) {
               
                // Can we handle the requested wire format?
                WireFormatInfo info = (WireFormatInfo) packet;
                if (!canProcessWireFormatVersion(info.getVersion())) {
                  response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: " + info.getVersion());
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.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.