sagneta
sagneta

Reputation: 1691

How to create durable queue using Artemis JMS Management API

It's a long story but I need to create a durable queue using the Artemis JMS Management API. Currently the code creates a temporary queue as a default:

JMSManagementHelper.putOperationInvocation("jms.server", "createQueue", "MyqueueName", null, null, true);

I think the original author assumed this would create a durable queue but apparently not. I can't find good documentation on this and was wondering if anybody could confirm/deny this.

Thanks in advance.

Upvotes: 4

Views: 2517

Answers (1)

user7610
user7610

Reputation: 28751

The documentation for this is https://activemq.apache.org/artemis/docs/latest/management.html or management.md in GitHub. Then there is the API doc to find the details.

Looking at https://activemq.apache.org/artemis/docs/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.html#createQueue-java.lang.String-java.lang.String-java.lang.String- the method you want to call is

createQueue(String address, String name, String filter, boolean durable)

Documentation says

If address is null it will be defaulted to name.

You are setting name to null, not address. If I instead run

JMSManagementHelper.putOperationInvocation("0.0.0.0", "createQueue", null, "MyqueueName", null, true);

that does not work either. I believe it is a bug. Will investigate more and report that.

So I duplicate the queue name

JMSManagementHelper.putOperationInvocation("0.0.0.0", "createQueue", "MyqueueName", "MyqueueName", null, true);

and now I correctly get a durable queue.

Upvotes: 2

Related Questions