Package org.apache.qpid.management.common.mbeans

Examples of org.apache.qpid.management.common.mbeans.ManagedQueue


        String addrWithAltExch = String.format("ADDR:%s;{create:always,node:{type:queue,x-declare:{alternate-exchange:'%s'}}}", queueName, altExchange);
        Queue queue = _session.createQueue(addrWithAltExch);

        createQueueOnBroker(queue);

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertEquals("Newly created queue does not have expected alternate exchange", altExchange, managedQueue.getAlternateExchange());

        managedQueue.setAlternateExchange("");
        assertNull("Unexpected alternate exchange after set", managedQueue.getAlternateExchange());
    }
View Full Code Here


        Queue queue2 = _session.createQueue(addr2WithoutAltExch);

        createQueueOnBroker(queue1);
        createQueueOnBroker(queue2);

        ManagedQueue managedQueue1 = _jmxUtils.getManagedQueue(queueName1);
        assertEquals("Newly created queue1 does not have expected alternate exchange", altExchange1, managedQueue1.getAlternateExchange());

        ManagedQueue managedQueue2 = _jmxUtils.getManagedQueue(queueName2);
        assertNull("Newly created queue2 does not have expected alternate exchange", managedQueue2.getAlternateExchange());

        String altExchange2 = nonMandatoryExchangeName;
        managedQueue2.setAlternateExchange(altExchange2);

        restartBroker();

        managedQueue1 = _jmxUtils.getManagedQueue(queueName1);
        assertEquals("Queue1 does not have expected alternate exchange after restart", altExchange1, managedQueue1.getAlternateExchange());

        managedQueue2 = _jmxUtils.getManagedQueue(queueName2);
        assertEquals("Queue2 does not have expected updated alternate exchange after restart", altExchange2, managedQueue2.getAlternateExchange());
    }
View Full Code Here

        final long maximumMessageCount = 3;

        Queue queue = _session.createQueue(queueName);
        createQueueOnBroker(queue);

        ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        managedQueue.setMaximumMessageCount(maximumMessageCount);

        RecordingNotificationListener listener = new RecordingNotificationListener(1);

        _jmxUtils.addNotificationListener(_jmxUtils.getQueueObjectName(VIRTUAL_HOST, queueName), listener, null, null);
View Full Code Here

        producer = producerSession.createProducer(queue);
       
        Thread.sleep(1000);
       
        //Create a JMX MBean proxy for the queue
        ManagedQueue queueMBean = _jmxUtils.getManagedObject(ManagedQueue.class, _jmxUtils.getQueueObjectName("test", queueName));
        assertNotNull(queueMBean);
       
        //check current attribute values are 0 as expected
        assertTrue("Capacity was not the expected value", queueMBean.getCapacity() == 0L);
        assertTrue("FlowResumeCapacity was not the expected value", queueMBean.getFlowResumeCapacity() == 0L);
       
        //set new values that will cause flow control to be active, and the queue to become overfull after 1 message is sent
        queueMBean.setCapacity(250L);
        queueMBean.setFlowResumeCapacity(250L);
        assertTrue("Capacity was not the expected value", queueMBean.getCapacity() == 250L);
        assertTrue("FlowResumeCapacity was not the expected value", queueMBean.getFlowResumeCapacity() == 250L);
        assertFalse("Queue should not be overfull", queueMBean.isFlowOverfull());
       
        // try to send 2 messages (should block after 1)
        _sentMessages.set(0);
        sendMessagesAsync(producer, producerSession, 2, 50L);

        Thread.sleep(2000);

        //check only 1 message was sent, and queue is overfull
        assertEquals("Incorrect number of message sent before blocking", 1, _sentMessages.get());
        assertTrue("Queue should be overfull", queueMBean.isFlowOverfull());
       
        //raise the attribute values, causing the queue to become underfull and allow the second message to be sent.
        queueMBean.setCapacity(300L);
        queueMBean.setFlowResumeCapacity(300L);
       
        Thread.sleep(2000);

        //check second message was sent, and caused the queue to become overfull again
        assertEquals("Second message was not sent after lifting FlowResumeCapacity", 2, _sentMessages.get());
        assertTrue("Queue should be overfull", queueMBean.isFlowOverfull());
       
        //raise capacity above queue depth, check queue remains overfull as FlowResumeCapacity still exceeded
        queueMBean.setCapacity(700L);
        assertTrue("Queue should be overfull", queueMBean.isFlowOverfull());
       
        //receive a message, check queue becomes underfull
       
        consumer = consumerSession.createConsumer(queue);
        consumerConnection.start();
       
        consumer.receive();
       
        //perform a synchronous op on the connection
        ((AMQSession) consumerSession).sync();
       
        assertFalse("Queue should not be overfull", queueMBean.isFlowOverfull());
       
        consumer.receive();
    }
View Full Code Here

        Queue queue = _session.createQueue(getTestQueueName());
        createQueueOnBroker(queue);

        final String queueName = queue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertEquals("Unexpected name", queueName, managedQueue.getName());
        assertEquals("Unexpected queue type", "standard", managedQueue.getQueueType());
    }
View Full Code Here

    {
        Queue tmpQueue = _session.createTemporaryQueue();

        final String queueName = tmpQueue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertNotNull(_connection.getClientID());
        assertEquals("Unexpected owner", _connection.getClientID(), managedQueue.getOwner());
    }
View Full Code Here

        Queue nonExclusiveQueue = _session.createQueue(getTestQueueName());
        createQueueOnBroker(nonExclusiveQueue);

        final String queueName = nonExclusiveQueue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertNull("Unexpected owner", managedQueue.getOwner());
    }
View Full Code Here

        Queue queue = _session.createQueue(getTestQueueName());
        createQueueOnBroker(queue);

        final String queueName = queue.getQueueName();

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertNull("Unexpected description", managedQueue.getDescription());

        managedQueue.setDescription(TEST_QUEUE_DESCRIPTION);
        assertEquals(TEST_QUEUE_DESCRIPTION, managedQueue.getDescription());
    }
View Full Code Here

    {
        String queueName = getTestQueueName();
        Map<String, Object> arguments = Collections.singletonMap(AMQQueueFactory.X_QPID_DESCRIPTION, (Object)TEST_QUEUE_DESCRIPTION);
        ((AMQSession<?, ?>)_session).createQueue(AMQShortString.valueOf(queueName), false, true, false, arguments);

        final ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertEquals(TEST_QUEUE_DESCRIPTION, managedQueue.getDescription());
    }
View Full Code Here

        String queueName = getTestQueueName();
        Map<String, Object> arguments = Collections.singletonMap(AMQQueueFactory.X_QPID_DESCRIPTION, (Object)TEST_QUEUE_DESCRIPTION);

        ((AMQSession<?, ?>)_session).createQueue(AMQShortString.valueOf(queueName), false, true, false, arguments);

        ManagedQueue managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertEquals(TEST_QUEUE_DESCRIPTION, managedQueue.getDescription());

        restartBroker();

        managedQueue = _jmxUtils.getManagedQueue(queueName);
        assertEquals(TEST_QUEUE_DESCRIPTION, managedQueue.getDescription());
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.management.common.mbeans.ManagedQueue

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.