Search code examples
jmshornetqactivemq-artemis

activemq-artemis management message request for list of topics isn't responding


I'm working on a java service program that previously used OpenMQ as the JMS provider, but I am converting it to use activemq-artemis.

I need to get a list of existing topics/queues from artemis. So far I have the code below, which I developed from the examples that come with artemis combined with some other code samples I found on the web (leaving try/catch out):

    TransportConfiguration tportConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());
    QueueConnectionFactory qcf = (QueueConnectionFactory) ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.QUEUE_CF, tportConfig);

    QueueConnection qConn = qcf.createQueueConnection();

    QueueSession session = qConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

    javax.jms.Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management");

    QueueRequestor requestor = new QueueRequestor(session, managementQueue);

    qConn.start();

    Message mgtMsg = session.createMessage();

    JMSManagementHelper.putAttribute(mgtMsg, org.apache.activemq.artemis.api.core.management.ResourceNames.JMS_SERVER, "topicNames");

    Message reply = requestor.request(mgtMsg);

Stepping over each line in the debugger, the code works as far as I can tell until the final requestor.request() method call. After this is invoked, it seems the thread black holes. The debugger doesn't come to the next line, the catch block isn't started and the artemis.log doesn't record any type of error. I get the same result if I use the string queueNames in the putAttribute call.

Is there an issue with my code, or can someone give me some insight into what may be happening?

Additional details: artemis server 2.1.0 and client code are running locally on a single development machine, JDK7u65, with test code outside of this project I can publish and consume a simple message to/from artemis.

Thanks.


Solution

  • ...the code works as far as I can tell until the final requestor.request() method call. After this is invoked, it seems the thread black holes. The debugger doesn't come to the next line, the catch block isn't started and the artemis.log doesn't record any type of error.

    This sounds like the normal behavior of a JMS requestor when it receives no response to the request it sent.

    artemis server 2.1.0 and client code are running locally on a single development machine

    The constant org.apache.activemq.artemis.api.core.management.ResourceNames.JMS_SERVER you're attempting to use doesn't actually exist in Artemis 2.1.0. Your client must be using a 1.x library instead of what you have described here otherwise you would get compilation errors.

    This is likely the root of your problem. In other words, you're attempting to manage a resource (i.e. the JMS server) that doesn't actually exist.

    That said, I would have expected the broker to log a WARN message about not being able to find the resource.

    I recommend: