use of org.apache.activemq.broker.jmx.QueueViewMBean in project activemq-artemis by apache.
the class QueuePurgeTest method getProxyToQueueViewMBean.
private QueueViewMBean getProxyToQueueViewMBean() throws MalformedObjectNameException, JMSException {
ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queue.getQueueName());
QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
return proxy;
}
use of org.apache.activemq.broker.jmx.QueueViewMBean in project activemq-artemis by apache.
the class BrowseDLQTest method assertCanBrowse.
private void assertCanBrowse() throws MalformedObjectNameException, OpenDataException {
ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=ActiveMQ.DLQ");
QueueViewMBean queue = (QueueViewMBean) brokerService.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true);
// make sure we have messages here
assertTrue(queue.getQueueSize() > 0);
CompositeData[] regularBrowse = queue.browse();
assertNotNull(regularBrowse);
TabularData tableData = queue.browseAsTable();
assertNotNull(tableData);
}
use of org.apache.activemq.broker.jmx.QueueViewMBean in project activemq-artemis by apache.
the class ConsumeUncompressedCompressedMessageTest method testBrowseAndReceiveCompressedMessages.
@Test
public void testBrowseAndReceiveCompressedMessages() throws Exception {
assertTrue(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];
assertComplexData(0, cdata, "Text", "Test Text Message: " + 0);
assertMessageAreCorrect(1);
}
use of org.apache.activemq.broker.jmx.QueueViewMBean in project activemq-artemis by apache.
the class BrokerNetworkWithStuckMessagesTest method browseQueueWithJmx.
private Object[] browseQueueWithJmx(BrokerService broker) throws Exception {
Hashtable<String, String> params = new Hashtable<>();
params.put("brokerName", broker.getBrokerName());
params.put("type", "Broker");
params.put("destinationType", "Queue");
params.put("destinationName", queueName);
ObjectName queueObjectName = ObjectName.getInstance(amqDomain, params);
ManagementContext mgmtCtx = broker.getManagementContext();
QueueViewMBean queueView = (QueueViewMBean) mgmtCtx.newProxyInstance(queueObjectName, QueueViewMBean.class, true);
Object[] messages = queueView.browse();
LOG.info("+Browsed with JMX: " + messages.length);
return messages;
}
use of org.apache.activemq.broker.jmx.QueueViewMBean in project activemq-artemis by apache.
the class OpenTypeSupportTest method bytesMessagePreview.
@Test
public void bytesMessagePreview() throws Exception {
QueueViewMBean queue = getProxyToQueueViewMBean();
assertEquals(extractText(queue.browse()[0]), extractText(queue.browse()[0]));
}
Aggregations