Package org.apache.qpid.server.queue

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


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

        AMQQueue queue;
        if (body.getQueue() == null)
        {
            AMQChannel channel = session.getChannel(channelId);

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

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

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


        initialiseDriver();

        _virtualHost = virtualHost;

        _logger.info("Configuring Derby message store for virtual host " + virtualHost.getName());
        QueueRegistry queueRegistry = virtualHost.getQueueRegistry();

        //Update to pick up QPID_WORK and use that as the default location not just derbyDB
        final String databasePath = config.getStoreConfiguration().getString(ENVIRONMENT_PATH_PROPERTY, "derbyDB");

        File environmentPath = new File(databasePath);
View Full Code Here

    private void recoverExchange(Exchange exchange) throws AMQException, SQLException
    {
        _logger.info("Recovering durable exchange " + exchange.getName() + " of type " + exchange.getType() + "...");

        QueueRegistry queueRegistry = _virtualHost.getQueueRegistry();

        Connection conn = null;
        try
        {
            conn = newConnection();

            PreparedStatement stmt = conn.prepareStatement(SELECT_FROM_BINDINGS);
            stmt.setString(1, exchange.getName().toString());

            ResultSet rs = stmt.executeQuery();


            while(rs.next())
            {
                String queueName = rs.getString(1);
                String bindingKey = rs.getString(2);
                Blob arguments = rs.getBlob(3);


                AMQQueue queue = queueRegistry.getQueue(new AMQShortString(queueName));
                if (queue == null)
                {
                    _logger.error("Unkown queue: " + queueName + " cannot be bound to exchange: "
                        + exchange.getName());
                }
View Full Code Here

     */
    public void testMessageRemoval() throws Exception
    {
        testMessagePersistence();

        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        assertEquals("Incorrect number of queues registered after recovery",
                6,  queueRegistry.getQueues().size());

        //clear the queue
        queueRegistry.getQueue(durableQueueName).clearQueue();
       
        //check the messages are gone
        validateMessageOnQueue(durableQueueName, 0);
       
        //reload and verify messages arent restored
View Full Code Here

        createAllTopicQueues();

        //reload the virtual host, prompting recovery of the queues/topics
        reloadVirtualHost();

        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        assertEquals("Incorrect number of queues registered after recovery",
                6,  queueRegistry.getQueues().size());

        //Validate the non-Durable Queues were not recovered.
        assertNull("Non-Durable queue still registered:" + priorityQueueName,
                queueRegistry.getQueue(priorityQueueName));
        assertNull("Non-Durable queue still registered:" + queueName,
                queueRegistry.getQueue(queueName));
        assertNull("Non-Durable queue still registered:" + priorityTopicQueueName,
                queueRegistry.getQueue(priorityTopicQueueName));
        assertNull("Non-Durable queue still registered:" + topicQueueName,
                queueRegistry.getQueue(topicQueueName));

        //Validate normally expected properties of Queues/Topics
        validateDurableQueueProperties();

        //Update the durable exclusive queue's exclusivity and verify it is persisted and recovered correctly
View Full Code Here

    public void testDurableQueueRemoval() throws Exception
    {
        //Register Durable Queue
        createQueue(durableQueueName, false, true, false, false);

        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();
        assertEquals("Incorrect number of queues registered before recovery",
                1,  queueRegistry.getQueues().size());

        reloadVirtualHost();
       
        queueRegistry = getVirtualHost().getQueueRegistry();
        assertEquals("Incorrect number of queues registered after first recovery",
                1,  queueRegistry.getQueues().size());
       
        //test that removing the queue means it is not recovered next time
        getVirtualHost().getDurableConfigurationStore().removeQueue(queueRegistry.getQueue(durableQueueName));

        reloadVirtualHost();
       
        queueRegistry = getVirtualHost().getQueueRegistry();
        assertEquals("Incorrect number of queues registered after second recovery",
                0,  queueRegistry.getQueues().size());
        assertNull("Durable queue was not removed:" + durableQueueName,
                queueRegistry.getQueue(durableQueueName));
    }
View Full Code Here

     * recovering to verify the persistence, then removing it from the store, and ensuring
     * that following the second reload process it is not recovered.
     */
    public void testDurableBindingRemoval() throws Exception
    {
        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        //create durable queue and exchange, bind them
        Exchange exch = createExchange(DirectExchange.TYPE, directExchangeName, true);
        createQueue(durableQueueName, false, true, false, false);
        bindQueueToExchange(exch, directRouting, queueRegistry.getQueue(durableQueueName), false, null);

        assertEquals("Incorrect number of bindings registered before recovery",
                1, queueRegistry.getQueue(durableQueueName).getBindings().size());

        //verify binding is actually normally recovered
        reloadVirtualHost();

        queueRegistry = getVirtualHost().getQueueRegistry();
        assertEquals("Incorrect number of bindings registered after first recovery",
                1, queueRegistry.getQueue(durableQueueName).getBindings().size());

        ExchangeRegistry exchangeRegistry = getVirtualHost().getExchangeRegistry();
        exch = exchangeRegistry.getExchange(directExchangeName);
        assertNotNull("Exchange was not recovered", exch);

        //remove the binding and verify result after recovery
        unbindQueueFromExchange(exch, directRouting, queueRegistry.getQueue(durableQueueName), false, null);

        reloadVirtualHost();

        queueRegistry = getVirtualHost().getQueueRegistry();
        assertEquals("Incorrect number of bindings registered after second recovery",
                0, queueRegistry.getQueue(durableQueueName).getBindings().size());
    }
View Full Code Here

    }

    /** Validates the Durable queues and their properties are as expected following recovery */
    private void validateBindingProperties()
    {
        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        assertEquals("Incorrect number of (durable) queues following recovery", 6, queueRegistry.getQueues().size());

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

        }
    }

    private void setQueueExclusivity(boolean exclusive) throws AMQException
    {
        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        AMQQueue queue = queueRegistry.getQueue(durableExclusiveQueueName);

        queue.setExclusive(exclusive);
    }
View Full Code Here

        queue.setExclusive(exclusive);
    }

    private void validateQueueExclusivityProperty(boolean expected)
    {
        QueueRegistry queueRegistry = getVirtualHost().getQueueRegistry();

        AMQQueue queue = queueRegistry.getQueue(durableExclusiveQueueName);

        assertEquals("Queue exclusivity was incorrect", queue.isExclusive(), expected);
    }
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.