Package org.apache.qpid.server.queue

Examples of org.apache.qpid.server.queue.QueueRegistry


    }


    private void validateDurableQueueProperties()
    {
        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        validateQueueProperties(queueRegistry.getQueue(durablePriorityQueueName), true, true, false, false);
        validateQueueProperties(queueRegistry.getQueue(durablePriorityTopicQueueName), true, true, false, false);
        validateQueueProperties(queueRegistry.getQueue(durableQueueName), false, true, false, false);
        validateQueueProperties(queueRegistry.getQueue(durableTopicQueueName), false, true, false, false);
        validateQueueProperties(queueRegistry.getQueue(durableExclusiveQueueName), false, true, true, false);
        validateQueueProperties(queueRegistry.getQueue(durableLastValueQueueName), false, true, true, true);
    }
View Full Code Here


    private void bindAllQueuesToExchange(Exchange exchange, AMQShortString routingKey)
    {
        FieldTable queueArguments = new FieldTable();
        queueArguments.put(new AMQShortString(AMQQueueFactory.X_QPID_PRIORITIES), DEFAULT_PRIORTY_LEVEL);

        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(durablePriorityQueueName), false, queueArguments);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(durableQueueName), false, null);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(priorityQueueName), false, queueArguments);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(queueName), false, null);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(durableExclusiveQueueName), false, null);
    }
View Full Code Here

    private void bindAllTopicQueuesToExchange(Exchange exchange, AMQShortString routingKey)
    {
        FieldTable queueArguments = new FieldTable();
        queueArguments.put(new AMQShortString(AMQQueueFactory.X_QPID_PRIORITIES), DEFAULT_PRIORTY_LEVEL);

        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(durablePriorityTopicQueueName), true, queueArguments);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(durableTopicQueueName), true, null);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(priorityTopicQueueName), true, queueArguments);
        bindQueueToExchange(exchange, routingKey, queueRegistry.getQueue(topicQueueName), true, null);
    }
View Full Code Here

    protected void peer(AMQStateManager stateManager, AMQMethodEvent<A> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        VirtualHost virtualHost = session.getVirtualHost();
        ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();

        local(stateManager, evt);
        _logger.debug(new LogMessage("Handled {0} locally", evt.getMethod()));
    }
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<QueueDeleteBody> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        VirtualHost virtualHost = session.getVirtualHost();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
        MessageStore store = virtualHost.getMessageStore();

        QueueDeleteBody body = evt.getMethod();
        AMQQueue queue;
        if (body.queue == null)
        {
            AMQChannel channel = session.getChannel(evt.getChannelId());

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

            //get the default queue on the channel:           
            queue = channel.getDefaultQueue();
        }
        else
        {
            queue = queueRegistry.getQueue(body.queue);
        }

        if (queue == null)
        {
            if (_failIfNotFound)
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<ExchangeBoundBody> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        VirtualHost virtualHost = session.getVirtualHost();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();

        // 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.
        byte major = (byte)8;
        byte minor = (byte)0;
       
        ExchangeBoundBody body = evt.getMethod();

        AMQShortString exchangeName = body.exchange;
        AMQShortString queueName = body.queue;
        AMQShortString routingKey = body.routingKey;
        if (exchangeName == null)
        {
            throw new AMQException("Exchange exchange must not be null");
        }
        Exchange exchange = virtualHost.getExchangeRegistry().getExchange(exchangeName);
        AMQFrame response;
        if (exchange == null)
        {
            // AMQP version change:  Be aware of possible changes to parameter order as versions change.
            response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                major, minor,  // AMQP version (major, minor)
                EXCHANGE_NOT_FOUND,  // replyCode
                new AMQShortString("Exchange " + exchangeName + " not found"))// replyText
        }
        else if (routingKey == null)
        {
            if (queueName == null)
            {
                if (exchange.hasBindings())
                {
                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                        major, minor,  // AMQP version (major, minor)
                        OK,  // replyCode
                        null)// replyText
                }
                else
                {
                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                        major, minor,  // AMQP version (major, minor)
                        NO_BINDINGS,  // replyCode
                        null)// replyText
                }
            }
            else
            {

                AMQQueue queue = queueRegistry.getQueue(queueName);
                if (queue == null)
                {
                    // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                    response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                        major, minor,  // AMQP version (major, minor)
                        QUEUE_NOT_FOUND,  // replyCode
                        new AMQShortString("Queue " + queueName + " not found"))// replyText
                }
                else
                {
                    if (exchange.isBound(queue))
                    {
                        // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                        response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                            major, minor,  // AMQP version (major, minor)
                            OK,  // replyCode
                            null)// replyText
                    }
                    else
                    {
                        // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                        response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                            major, minor,  // AMQP version (major, minor)
                            QUEUE_NOT_BOUND,  // replyCode
                            new AMQShortString("Queue " + queueName + " not bound to exchange " + exchangeName))// replyText
                    }
                }
            }
        }
        else if (queueName != null)
        {
            AMQQueue queue = queueRegistry.getQueue(queueName);
            if (queue == null)
            {
                // AMQP version change:  Be aware of possible changes to parameter order as versions change.
                response = ExchangeBoundOkBody.createAMQFrame(evt.getChannelId(),
                    major, minor,  // AMQP version (major, minor)
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<QueueBindBody> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        VirtualHost virtualHost = session.getVirtualHost();
        ExchangeRegistry exchangeRegistry = virtualHost.getExchangeRegistry();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();

        final QueueBindBody body = evt.getMethod();
        final AMQQueue queue;
        if (body.queue == null)
        {
            AMQChannel channel = session.getChannel(evt.getChannelId());

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

            queue = channel.getDefaultQueue();

            if (queue == null)
            {
                throw body.getChannelException(AMQConstant.NOT_FOUND, "No default queue defined on channel and queue was null");
            }

            if (body.routingKey == null)
            {
                body.routingKey = queue.getName();
            }
        }
        else
        {
            queue = queueRegistry.getQueue(body.queue);
        }

        if (queue == null)
        {
            throw body.getChannelException(AMQConstant.NOT_FOUND, "Queue " + body.queue + " does not exist.");
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<QueuePurgeBody> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        VirtualHost virtualHost = session.getVirtualHost();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();

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

        QueuePurgeBody body = evt.getMethod();
        AMQQueue queue;
        if(body.queue == null)
        {

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

           //get the default queue on the channel:
           queue = channel.getDefaultQueue();
           
            if(queue == null)
            {
                if(_failIfNotFound)
                {
                    throw body.getConnectionException(AMQConstant.NOT_ALLOWED,"No queue specified.");
                }
            }
        }
        else
        {
            queue = queueRegistry.getQueue(body.queue);
        }

        if(queue == null)
        {
            if(_failIfNotFound)
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, QueueUnbindBody body, int channelId) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        VirtualHost virtualHost = session.getVirtualHost();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();


        final AMQQueue queue;
        final AMQShortString routingKey;


        AMQChannel channel = session.getChannel(channelId);
        if (channel == null)
        {
            throw body.getChannelNotFoundException(channelId);
        }

        if (body.getQueue() == null)
        {

            queue = channel.getDefaultQueue();

            if (queue == null)
            {
                throw body.getChannelException(AMQConstant.NOT_FOUND, "No default queue defined on channel and queue was null");
            }

            routingKey = body.getRoutingKey() == null ? null : body.getRoutingKey().intern();

        }
        else
        {
            queue = queueRegistry.getQueue(body.getQueue());
            routingKey = body.getRoutingKey() == null ? null : body.getRoutingKey().intern();
        }

        if (queue == null)
        {
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, QueueBindBody body, int channelId) throws AMQException
    {
        AMQProtocolSession protocolConnection = stateManager.getProtocolSession();
        VirtualHost virtualHost = protocolConnection.getVirtualHost();
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();
        AMQChannel channel = protocolConnection.getChannel(channelId);

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

        final AMQQueue queue;
        final AMQShortString routingKey;

        if (body.getQueue() == null)
        {

            queue = channel.getDefaultQueue();

            if (queue == null)
            {
                throw body.getChannelException(AMQConstant.NOT_FOUND, "No default queue defined on channel and queue was null");
            }

            if (body.getRoutingKey() == null)
            {
                routingKey = queue.getNameShortString();
            }
            else
            {
                routingKey = body.getRoutingKey().intern();
            }
        }
        else
        {
            queue = queueRegistry.getQueue(body.getQueue());
            routingKey = body.getRoutingKey() == null ? AMQShortString.EMPTY_STRING : body.getRoutingKey().intern();
        }

        if (queue == null)
        {
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.queue.QueueRegistry

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.