You can browse queues, but not topics.

Tim

On Aug 18, 2017 12:15 PM, "Hitesh" <hitesh.hotchand...@contentsphere.com>
wrote:

> Hi all,
>
> The following question is for ActiveMQ 5.13.
>
> I have 2 durable subscribers listening to a topic, lets say ExampleTopic.
> I need to delete all the messages on that topic when a particular event
> occurs. I tried to find the jolokia apis to do the same but couldn't find
> any.
> So I've decided to use JMX Mbeans to browse the messages and delete them
> one
> by one.
>
> A simple java program which will connect to JMXService and fetch the
> information for all the messages.
>
> JMXServiceURL url = new
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
> JMXConnector jmxc = JMXConnectorFactory.connect(url);
> MBeanServerConnection conn = jmxc.getMBeanServerConnection();
> ObjectName mbeanName = new
> ObjectName("org.apache.activemq:type=Broker,brokerName=localhost");
> TopicViewMBean bean = MBeanServerInvocationHandler.newProxyInstance(conn,
> mbeanName, TopicViewMBean.class, true);
> List list = bean.browseMessages();
>
> However this throws the following exception:
>
> java.lang.reflect.UndeclaredThrowableException
>         at com.sun.proxy.$Proxy0.browseMessages(Unknown Source)
>         at com.exportstaging.main.Test.main(Test.java:25)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at com.intellij.rt.execution.application.AppMain.main(
> AppMain.java:147)
> Caused by: javax.management.ReflectionException: No such operation:
> browseMessages
>
>
> I tried to find the web for this, but couldn't find any solution.
>
> Can someone help me fix this.
>
> Thanks in advance
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/JAVA-ActiveMQ-JMX-browse-messages-on-Topic-tp4729813.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to