Examples of AMQFrame


Examples of org.apache.qpid.framing.AMQFrame

                        if (((msgNumber % 1000) == 0) && _logger.isDebugEnabled())
                        {
                            _logger.debug("Received " + _messageReceivedCount + " protocol messages");
                        }

                        AMQFrame frame = (AMQFrame) message;

                        final AMQBody bodyFrame = frame.getBodyFrame();

                        bodyFrame.handle(frame.getChannel(), _protocolSession);

                        _connection.bytesReceived(_readBytes);
                    }
                    else if (message instanceof ProtocolInitiation)
                    {
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

            // Connection is already closed then don't do a syncWrite
            try
            {
                final ConnectionCloseBody body = _protocolSession.getMethodRegistry().createConnectionCloseBody(AMQConstant.REPLY_SUCCESS.getCode(), // replyCode
                        new AMQShortString("JMS client is closing the connection."), 0, 0);
                final AMQFrame frame = body.generateFrame(0);

                syncWrite(frame, ConnectionCloseOkBody.class, timeout);
                _network.close();
                closed();
            }
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

            {
                capacity = bodySize - writtenSize > maxBodySize ? maxBodySize : bodySize - writtenSize;
                MessageContentSourceBody body = new MessageContentSourceBody(message, writtenSize, capacity);
                writtenSize += capacity;

                writeFrame(new AMQFrame(channelId, body));
            }
        }
    }
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

    {
        //Create a new ProtocolHandler with a fake connection.
        _handler = new AMQProtocolHandler(new MockAMQConnection("amqp://guest:guest@client/test?brokerlist='tcp://localhost:1'"));
        _handler.setNetworkConnection(new TestNetworkConnection());
         AMQBody body = BasicRecoverOkBodyImpl.getFactory().newInstance(null, 1);
        _blockFrame = new AMQFrame(0, body);

        _handleCountDown = new CountDownLatch(1);

        _logger.info("Creating _Listener that should also receive the thrown exception.");
        _listener = new BlockToAccessFrameListener(1);
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

                                                                                              true,
                                                                                              null);
        // Declare the exchange
        // Note that the durable and internal arguments are ignored since passive is set to false

        AMQFrame declare = body.generateFrame(_channelId);

        _protocolHandler.writeFrame(declare);
    }
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

                                                                                        destination.getExchangeName(),
                                                                                        destination.getRoutingKey(),
                                                                                        mandatory,
                                                                                        immediate);

        AMQFrame publishFrame = body.generateFrame(_channelId);

        message.prepareForSending();
        ByteBuffer payload = message.getData();
        AMQMessageDelegate_0_8 delegate = (AMQMessageDelegate_0_8) message.getDelegate();
        BasicContentHeaderProperties contentHeaderProperties = delegate.getContentHeaderProperties();

        contentHeaderProperties.setUserId(_userID);

        //Set the JMS_QPID_DESTTYPE for 0-8/9 messages
        int type;
        if (destination instanceof Topic)
        {
            type = AMQDestination.TOPIC_TYPE;
        }
        else if (destination instanceof Queue)
        {
            type = AMQDestination.QUEUE_TYPE;
        }
        else
        {
            type = AMQDestination.UNKNOWN_TYPE;
        }

        //Set JMS_QPID_DESTTYPE
        delegate.getContentHeaderProperties().getHeaders().setInteger(CustomJMSXProperty.JMS_QPID_DESTTYPE.getShortStringName(), type);

        if (!_disableTimestamps)
        {
            final long currentTime = System.currentTimeMillis();
            contentHeaderProperties.setTimestamp(currentTime);

            if (timeToLive > 0)
            {
                contentHeaderProperties.setExpiration(currentTime + timeToLive);
            }
            else
            {
                contentHeaderProperties.setExpiration(0);
            }
        }

        contentHeaderProperties.setDeliveryMode((byte) deliveryMode);
        contentHeaderProperties.setPriority((byte) priority);

        final int size = (payload != null) ? payload.limit() : 0;
        final int contentBodyFrameCount = calculateContentBodyFrameCount(payload);
        final AMQFrame[] frames = new AMQFrame[2 + contentBodyFrameCount];

        if (payload != null)
        {
            createContentBodies(payload, frames, 2, _channelId);
        }

        if ((contentBodyFrameCount != 0) && _logger.isDebugEnabled())
        {
            _logger.debug("Sending content body frames to " + destination);
        }


        // TODO: This is a hacky way of getting the AMQP class-id for the Basic class
        int classIfForBasic = getSession().getMethodRegistry().createBasicQosOkBody().getClazz();

        AMQFrame contentHeaderFrame =
            ContentHeaderBody.createAMQFrame(_channelId,
                                             classIfForBasic, 0, contentHeaderProperties, size);
        if (_logger.isDebugEnabled())
        {
            _logger.debug("Sending content header frame to " + destination);
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

                                if (debug && ((msgNumber % 1000) == 0))
                                {
                                    _logger.debug("Received " + _messageReceivedCount + " protocol messages");
                                }

                                AMQFrame frame = (AMQFrame) message;

                                final AMQBody bodyFrame = frame.getBodyFrame();

                                HeartbeatDiagnostics.received(bodyFrame instanceof HeartbeatBody);

                                bodyFrame.handle(frame.getChannel(), _protocolSession);

                                _connection.bytesReceived(_readBytes);
                            }
                            else if (message instanceof ProtocolInitiation)
                            {
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

    public void closeConnection(long timeout) throws AMQException
    {
        ConnectionCloseBody body = _protocolSession.getMethodRegistry().createConnectionCloseBody(AMQConstant.REPLY_SUCCESS.getCode(), // replyCode
                                                                                                  new AMQShortString("JMS client is closing the connection."), 0, 0);

        final AMQFrame frame = body.generateFrame(0);

        //If the connection is already closed then don't do a syncWrite
        if (!getStateManager().getCurrentState().equals(AMQState.CONNECTION_CLOSED))
        {
            try
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

        {
            MethodRegistry_8_0 registry = new MethodRegistry_8_0();

            ExchangeDeleteBody body = registry.createExchangeDeleteBody(0, new AMQShortString(_name), false, true);

            AMQFrame exchangeDeclare = body.generateFrame(0);

            ((AMQConnection) _connection).getProtocolHandler().syncWrite(exchangeDeclare, ExchangeDeleteOkBody.class);
        }

        //Wait and ensure we get our last EXH-1002 msg
View Full Code Here

Examples of org.apache.qpid.framing.AMQFrame

    public void acknowledgeMessage(long deliveryTag, boolean multiple)
    {
        BasicAckBody body = getMethodRegistry().createBasicAckBody(deliveryTag, multiple);

        final AMQFrame ackFrame = body.generateFrame(_channelId);

        if (_logger.isDebugEnabled())
        {
            _logger.debug("Sending ack for delivery tag " + deliveryTag + " on channel " + _channelId);
        }
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.