Package org.apache.activemq.broker.jmx

Examples of org.apache.activemq.broker.jmx.QueueViewMBean


    }

    @Test
    public void testCacheDisableReEnable() throws Exception {
        createProducerAndSendMessages(1);
        QueueViewMBean proxy = getProxyToQueueViewMBean();
        assertTrue("cache is enabled", proxy.isCacheEnabled());
        tearDown();
        createBroker(false);
        proxy = getProxyToQueueViewMBean();
        assertEquals("one pending message", 1, proxy.getQueueSize());
        assertTrue("cache is disabled when there is a pending message", !proxy.isCacheEnabled());

        createConsumer(1);
        createProducerAndSendMessages(1);
        assertTrue("cache is enabled again on next send when there are no messages", proxy.isCacheEnabled());
    }
View Full Code Here


    private QueueViewMBean getProxyToQueueViewMBean()
            throws MalformedObjectNameException, JMSException {
        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq"
                + ":Type=Queue,Destination=" + queue.getQueueName()
                + ",BrokerName=localhost");
        QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext()
                .newProxyInstance(queueViewMBeanName,
                        QueueViewMBean.class, true);
        return proxy;
    }
View Full Code Here

        assertTrue(((ActiveMQConnection) connection).isUseCompression());

        createProducerAndSendMessages(1);

        QueueViewMBean queueView = getProxyToQueueViewMBean();

        assertNotNull(queueView);

        CompositeData[] compdatalist = queueView.browse();
        if (compdatalist.length == 0) {
            fail("There is no message in the queue:");
        }

        CompositeData cdata = compdatalist[0];
View Full Code Here

    private QueueViewMBean getProxyToQueueViewMBean()
            throws MalformedObjectNameException, JMSException {
        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq"
                + ":Type=Queue,Destination=" + queue.getQueueName()
                + ",BrokerName=localhost");
        QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext()
                .newProxyInstance(queueViewMBeanName, QueueViewMBean.class,
                        true);
        return proxy;
    }
View Full Code Here

        params.put("Type", "Queue");
        params.put("Destination", queueName);
        ObjectName queueObjectName = ObjectName.getInstance(amqDomain, params);
       
        ManagementContext mgmtCtx = broker.getManagementContext();
        QueueViewMBean queueView = (QueueViewMBean)mgmtCtx.newProxyInstance(queueObjectName, QueueViewMBean.class, true);
       
        Object[] messages = (Object[]) queueView.browse();
       
    LOG.info("+Browsed with JMX: " + messages.length);
       
        return messages;
    }
View Full Code Here

        super(brokerFacade);
    }

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        if (messageId != null) {
            QueueViewMBean queueView = getQueueView();
            if (queueView != null) {
              log.info("Moving message " + getJMSDestination() + "(" + messageId + ")" + " to " + destination);
                queueView.moveMessageTo(messageId, destination);
            } else {
              log.warn("No queue named: " + getPhysicalDestinationName());
            }
        }
        return redirectToBrowseView();
View Full Code Here

        ActiveMQDestination amqDest = (ActiveMQDestination)destination;
        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=" +
                (amqDest.isTopic() ? "Topic" : "Queue") +",Destination="
                + amqDest.getPhysicalName() + ",BrokerName=localhost");

        QueueViewMBean queue = (QueueViewMBean) broker.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
        ObjectName slowConsumerPolicyMBeanName = queue.getSlowConsumerStrategy();

        assertNotNull(slowConsumerPolicyMBeanName);

        AbortSlowConsumerStrategyViewMBean abortPolicy = (AbortSlowConsumerStrategyViewMBean)
                broker.getManagementContext().newProxyInstance(slowConsumerPolicyMBeanName, AbortSlowConsumerStrategyViewMBean.class, true);
View Full Code Here

        params.put("Type", "Queue");
        params.put("Destination", queueName);
        ObjectName queueObjectName = ObjectName.getInstance(amqDomain, params);
       
        ManagementContext mgmtCtx = broker.getManagementContext();
        QueueViewMBean queueView = (QueueViewMBean)mgmtCtx.newProxyInstance(queueObjectName, QueueViewMBean.class, true);
       
        Object[] messages = (Object[]) queueView.browse();
       
    LOG.info("+Browsed with JMX: " + messages.length);
       
        return messages;
    }
View Full Code Here

        ActiveMQDestination amqDest = (ActiveMQDestination)destination;
        ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=" +
                (amqDest.isTopic() ? "Topic" : "Queue") +",Destination="
                + amqDest.getPhysicalName() + ",BrokerName=localhost");

        QueueViewMBean queue = (QueueViewMBean) broker.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
        ObjectName slowConsumerPolicyMBeanName = queue.getSlowConsumerStrategy();

        assertNotNull(slowConsumerPolicyMBeanName);

        AbortSlowConsumerStrategyViewMBean abortPolicy = (AbortSlowConsumerStrategyViewMBean)
                broker.getManagementContext().newProxyInstance(slowConsumerPolicyMBeanName, AbortSlowConsumerStrategyViewMBean.class, true);
View Full Code Here

    Set<ObjectName> brokers = connection.queryNames(name, null);
    return brokers;
  }
 
  public void purgeQueue(ActiveMQDestination destination) throws Exception {
    QueueViewMBean queue = getQueue(destination.getPhysicalName());
    queue.purge();
  }
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.jmx.QueueViewMBean

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.