Hi all,
I'm trying to create queues programmatically with the JMSManagementHelper
but they are only created as "multicast".
Here is so far the code I use after trying to figure out how to do it:
public void beforeAllTests() throws Exception {
try (
var cf = new ActiveMQConnectionFactory(brokerUrl,
username, password);
var connection = cf.createQueueConnection();
var queueSession = connection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
) {
this.connection = connection;
this.queueSession = queueSession;
var managementQueue =
ActiveMQJMSClient.createQueue("activemq.management");
queueRequestor = new QueueRequestor(queueSession, managementQueue);
connection.start();
createQueue("myQueue", false);
} catch (JMSException e) {
throw new RuntimeException(e);
}
}
public void afterAllTests() {
try {
queueSession.close();
connection.close();
} catch (JMSException e) {
throw new RuntimeException(e);
}
private boolean createQueue(String queueName, boolean isPersistent)
throws Exception {
var m = queueSession.createMessage();
JMSManagementHelper.putOperationInvocation(m,
ResourceNames.BROKER, "createQueue", queueName, queueName, null,
isPersistent);
var reply = queueRequestor.request(m);
return JMSManagementHelper.hasOperationSucceeded(reply);
}
I can't find anywhere to set it to anycast.
ActiveMQJMSClient.createQueue() is also deprecated though it's used in the
official examples. I'm not sure how to change either.
Thanks!
Franck