Package org.apache.qpid.server

Examples of org.apache.qpid.server.AMQChannel


        if (_log.isDebugEnabled())
        {
            _log.debug("Ack(Tag:" + body.deliveryTag + ":Mult:" + body.multiple + ") received on channel " + evt.getChannelId());
        }

        final AMQChannel channel = protocolSession.getChannel(evt.getChannelId());

        if (channel == null)
        {
            throw body.getChannelNotFoundException(evt.getChannelId());
        }

        // this method throws an AMQException if the delivery tag is not known
        channel.acknowledgeMessage(body.deliveryTag, body.multiple);
    }
View Full Code Here


            _logger.info("Received channel close for id " + evt.getChannelId() + " citing class " + body.classId +
                         " and method " + body.methodId);
        }
        int channelId = evt.getChannelId();

        AMQChannel channel = session.getChannel(channelId);

        if (channel == null)
        {
            throw body.getConnectionException(AMQConstant.CHANNEL_ERROR, "Trying to close unknown channel");
        }
View Full Code Here

    public SubscriptionImpl(int channelId, AMQProtocolSession protocolSession,
                            AMQShortString consumerTag, boolean acks, FieldTable filters,
                            boolean noLocal, AMQQueue queue)
            throws AMQException
    {
        AMQChannel channel = protocolSession.getChannel(channelId);
        if (channel == null)
        {
            throw new AMQException(AMQConstant.NOT_FOUND, "channel :" + channelId + " not found in protocol session");
        }
View Full Code Here

        else
        {
            // The partially populated BasicDeliver frame plus the received route body
            // is stored in the channel. Once the final body frame has been received
            // it is routed to the exchange.
            AMQChannel channel = session.getChannel(evt.getChannelId());

            if (channel == null)
            {
                throw body.getChannelNotFoundException(evt.getChannelId());
            }

            if(body.routingKey != null)
            {
                body.routingKey = body.routingKey.intern();
            }
           
            MessagePublishInfo info = session.getRegistry().getProtocolVersionMethodConverter().convertToInfo(body);
            channel.setPublishFrame(info, session);
        }
    }
View Full Code Here

     */
    public void commitTransactions(int channelId) throws JMException
    {
        try
        {
            AMQChannel channel = _session.getChannel(channelId);
            if (channel == null)
            {
                throw new JMException("The channel (channel Id = " + channelId + ") does not exist");
            }

View Full Code Here

     */
    public void rollbackTransactions(int channelId) throws JMException
    {
        try
        {
            AMQChannel channel = _session.getChannel(channelId);
            if (channel == null)
            {
                throw new JMException("The channel (channel Id = " + channelId + ") does not exist");
            }

View Full Code Here

        AMQProtocolSession session = stateManager.getProtocolSession();

        BasicConsumeBody body = evt.getMethod();
        final int channelId = evt.getChannelId();

        AMQChannel channel = session.getChannel(channelId);

        VirtualHost vHost = session.getVirtualHost();

        if (channel == null)
        {
            throw body.getChannelNotFoundException(evt.getChannelId());
        }
        else
        {
            if (_log.isDebugEnabled())
            {
                _log.debug("BasicConsume: from '" + body.queue +
                           "' for:" + body.consumerTag +
                           " nowait:" + body.nowait +
                           " args:" + body.arguments);
            }

            AMQQueue queue = body.queue == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.queue);

            if (queue == null)
            {
                if (_log.isTraceEnabled())
                {
                    _log.trace("No queue for '" + body.queue + "'");
                }
                if (body.queue != null)
                {
                    String msg = "No such queue, '" + body.queue + "'";
                    throw body.getChannelException(AMQConstant.NOT_FOUND, msg);
                }
                else
                {
                    String msg = "No queue name provided, no default queue defined.";
                    throw body.getConnectionException(AMQConstant.NOT_ALLOWED, msg);
                }
            }
            else
            {

                if (body.consumerTag != null)
                {
                    body.consumerTag = body.consumerTag.intern();
                }

                try
                {
                    AMQShortString consumerTag = channel.subscribeToQueue(body.consumerTag, queue, session, !body.noAck,
                                                                          body.arguments, body.noLocal, body.exclusive);
                    if (!body.nowait)
                    {
                        // 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.
View Full Code Here

    protected void setUp() throws Exception
    {
        super.setUp();
        _messageStore = new TestableMemoryMessageStore();
        _protocolSession = new MockProtocolSession(_messageStore);
        _channel = new AMQChannel(_protocolSession,5, _messageStore, null/*dont need exchange registry*/);

        _protocolSession.addChannel(_channel);
        _subscriptionManager = new SubscriptionSet();
        _queue = new AMQQueue(new AMQShortString("myQ"), false, new AMQShortString("guest"), true, ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost("test"), _subscriptionManager);
    }
View Full Code Here

                                                                           + " as exclusive queue with same name "
                                                                           + "declared on another client ID('"
                                                                           + queue.getOwner() + "')");
            }

            AMQChannel channel = session.getChannel(evt.getChannelId());

            if (channel == null)
            {
                throw body.getChannelNotFoundException(evt.getChannelId());
            }

            //set this as the default queue on the channel:
            channel.setDefaultQueue(queue);
        }

        if (!body.nowait)
        {
            // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
View Full Code Here

    }

    public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<BasicQosBody> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        AMQChannel channel = session.getChannel(evt.getChannelId());
        if (channel == null)
        {
            throw evt.getMethod().getChannelNotFoundException(evt.getChannelId());
        }

        channel.setPrefetchCount(evt.getMethod().prefetchCount);
        channel.setPrefetchSize(evt.getMethod().prefetchSize);

        // 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.
        session.writeFrame(BasicQosOkBody.createAMQFrame(evt.getChannelId(), (byte) 8, (byte) 0));
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.AMQChannel

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.