Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.AMQFrame


    private void declareDestination(AMQDestination destination)
    {
        // Declare the exchange
        // Note that the durable and internal arguments are ignored since passive is set to false
        // TODO: Be aware of possible changes to parameter order as versions change.
        AMQFrame declare =
            ExchangeDeclareBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
                _protocolHandler.getProtocolMinorVersion(), null, // arguments
                false, // autoDelete
                false, // durable
                destination.getExchangeName(), // exchange
View Full Code Here


        message.getJmsHeaders().setInteger(CustomJMSXProperty.JMS_QPID_DESTTYPE.getShortStringName(), type);

        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
        // Be aware of possible changes to parameter order as versions change.
        AMQFrame publishFrame =
            BasicPublishBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
                _protocolHandler.getProtocolMinorVersion(), destination.getExchangeName(), // exchange
                immediate, // immediate
                mandatory, // mandatory
                destination.getRoutingKey(), // routingKey
                _session.getTicket()); // ticket

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

        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);
        }

        // weight argument of zero indicates no child content headers, just bodies
        // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
        // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
        AMQFrame contentHeaderFrame =
            ContentHeaderBody.createAMQFrame(_channelId,
                BasicConsumeBody.getClazz(_protocolHandler.getProtocolMajorVersion(),
                    _protocolHandler.getProtocolMinorVersion()), 0, contentHeaderProperties, size);
        if (_logger.isDebugEnabled())
        {
View Full Code Here

        {
            _logger.debug("Channel close reply code: " + errorCode + ", reason: " + reason);
        }

        // TODO: Be aware of possible changes to parameter order as versions change.
        AMQFrame frame = ChannelCloseOkBody.createAMQFrame(evt.getChannelId(), method.getMajor(), method.getMinor());
        protocolSession.writeFrame(frame);
        if (errorCode != AMQConstant.REPLY_SUCCESS)
        {
            if (_logger.isDebugEnabled())
            {
View Full Code Here

                }

                if (sendClose)
                {
                    // TODO: Be aware of possible changes to parameter order as versions change.
                    final AMQFrame cancelFrame =
                            BasicCancelBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
                                                           _protocolHandler.getProtocolMinorVersion(), _consumerTag, // consumerTag
                                                           false); // nowait

                    try
View Full Code Here

            // Evaluate server challenge
            byte[] response = client.evaluateChallenge(body.challenge);
            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
            // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
            // Be aware of possible changes to parameter order as versions change.
            AMQFrame responseFrame = ConnectionSecureOkBody.createAMQFrame(evt.getChannelId(),
                body.getMajor(), body.getMinor(),
                response)// response
            protocolSession.writeFrame(responseFrame);
        }
        catch (SaslException e)
View Full Code Here

     *
     * @todo Be aware of possible changes to parameter order as versions change.
     */
    public void acknowledgeMessage(long deliveryTag, boolean multiple)
    {
        final AMQFrame ackFrame =
                BasicAckBody.createAMQFrame(_channelId, getProtocolMajorVersion(), getProtocolMinorVersion(), deliveryTag,
                                            multiple);

        if (_logger.isDebugEnabled())
        {
View Full Code Here

        /*new FailoverRetrySupport<Object, AMQException>(new FailoverProtectedOperation<Object, AMQException>()*/
        new FailoverNoopSupport<Object, AMQException>(new FailoverProtectedOperation<Object, AMQException>()
        {
            public Object execute() throws AMQException, FailoverException
            {
                AMQFrame queueBind =
                        QueueBindBody.createAMQFrame(_channelId, getProtocolMajorVersion(), getProtocolMinorVersion(),
                                                     arguments, // arguments
                                                     exchangeName, // exchange
                                                     false, // nowait
                                                     queueName, // queue
View Full Code Here

                    try
                    {

                        getProtocolHandler().closeSession(this);

                        final AMQFrame frame =
                                ChannelCloseBody.createAMQFrame(getChannelId(), getProtocolMajorVersion(), getProtocolMinorVersion(),
                                                                0, // classId
                                                                0, // methodId
                                                                AMQConstant.REPLY_SUCCESS.getCode(), // replyCode
                                                                new AMQShortString("JMS client closing channel")); // replyText
View Full Code Here

    {
        new FailoverRetrySupport<Object, AMQException>(new FailoverProtectedOperation<Object, AMQException>()
        {
            public Object execute() throws AMQException, FailoverException
            {
                AMQFrame queueDeclare =
                        QueueDeclareBody.createAMQFrame(_channelId, getProtocolMajorVersion(), getProtocolMinorVersion(),
                                                        null, // arguments
                                                        autoDelete, // autoDelete
                                                        durable, // durable
                                                        exclusive, // exclusive
View Full Code Here

            if (_logger.isDebugEnabled())
            {
                _logger.debug("Rejecting delivery tag:" + deliveryTag + ":SessionHC:" + this.hashCode());
            }

            AMQFrame basicRejectBody =
                    BasicRejectBody.createAMQFrame(_channelId, getProtocolMajorVersion(), getProtocolMinorVersion(), deliveryTag,
                                                   requeue);

            _connection.getProtocolHandler().writeFrame(basicRejectBody);
        }
View Full Code Here

TOP

Related Classes of org.apache.qpid.framing.AMQFrame

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.