Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.AMQFrame



    public void sendRollback() throws AMQException, FailoverException
    {
        TxRollbackBody body = getMethodRegistry().createTxRollbackBody();
        AMQFrame frame = body.generateFrame(getChannelId());
        getProtocolHandler().syncWrite(frame, TxRollbackOkBody.class);
    }
View Full Code Here


    }

    protected Long requestQueueDepth(AMQDestination amqd) throws AMQException, FailoverException
    {
        AMQFrame queueDeclare =
            getMethodRegistry().createQueueDeclareBody(getTicket(),
                                                       amqd.getAMQQueueName(),
                                                       true,
                                                       amqd.isDurable(),
                                                       amqd.isExclusive(),
View Full Code Here

            protocolInitiationReceived((ProtocolInitiation) message);

        }
        else if (message instanceof AMQFrame)
        {
            AMQFrame frame = (AMQFrame) message;
            frameReceived(frame);

        }
        else
        {
View Full Code Here

    }

    public AMQFrame getCloseFrame(int channel)
    {
        MethodRegistry reg = MethodRegistry.getMethodRegistry(new ProtocolVersion(major,minor));
        return new AMQFrame(0,
                            reg.createConnectionCloseBody(getErrorCode().getCode(),
                                                          getMessageAsShortString(),
                                                          _classId,
                                                          _methodId));
View Full Code Here

    }

    public AMQFrame getCloseFrame(int channel)
    {
        MethodRegistry reg = MethodRegistry.getMethodRegistry(new ProtocolVersion(major,minor));
        return new AMQFrame(channel, reg.createChannelCloseBody(getErrorCode() == null ? AMQConstant.INTERNAL_ERROR.getCode() : getErrorCode().getCode(), getMessageAsShortString(),_classId,_methodId));
    }
View Full Code Here

        {
            MethodRegistry_8_0 registry = new MethodRegistry_8_0();

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

            AMQFrame exchangeDeclare = body.generateFrame(((AMQSession)_session).getChannelId());

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

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

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

        ChannelCloseOkBody body = session.getMethodRegistry().createChannelCloseOkBody();
        AMQFrame frame = body.generateFrame(channelId);
        session.writeFrame(frame);
        try
        {
            if (errorCode != AMQConstant.REPLY_SUCCESS)
            {
View Full Code Here

        // Also set a different exchange class string so the attempt to declare
        // the exchange causes an exchange.
        ExchangeDeclareBody body = session.getMethodRegistry().createExchangeDeclareBody(session.getTicket(), new AMQShortString(EXCHANGE_NAME), null,
                                                                                         true, false, false, false, true, null);

        AMQFrame exchangeDeclare = body.generateFrame(session.getChannelId());

        try
        {
            // block our thread so that can times out
            connection.getProtocolHandler().syncWrite(exchangeDeclare, ExchangeDeclareOkBody.class);
View Full Code Here

                                                         destination.isExchangeDurable(),
                                                         destination.isExchangeAutoDelete(),
                                                         destination.isExchangeInternal(),
                                                         true,
                                                         null);
            AMQFrame declare = body.generateFrame(getChannelId());

            getConnection().getProtocolHandler().writeFrame(declare);
        }
    }
View Full Code Here

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

        AMQFrame publishFrame = body.generateFrame(getChannelId());

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

        contentHeaderProperties.setUserId(getUserID());

        //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 (!isDisableTimestamps())
        {
            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, getChannelId());
        }

        if ((contentBodyFrameCount != 0) && getLogger().isDebugEnabled())
        {
            getLogger().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(getChannelId(),
                                             classIfForBasic, 0, contentHeaderProperties, size);
        if (getLogger().isDebugEnabled())
        {
            getLogger().debug("Sending content header frame to " + destination);
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.