Skip to content

Commit

Permalink
Merge pull request wildfly#17469 from ehsavoie/WFLY-18820
Browse files Browse the repository at this point in the history
[WFLY-18820]: Queue creation might fail if auto-create-addresses is set to false.
  • Loading branch information
bstansberry authored Jan 19, 2024
2 parents 97a0c0e + 1b8d2c7 commit b3733d5
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,32 @@ public void createQueue(ConnectionFactory cf, Queue managementQueue, String queu
connection.start();
QueueRequestor requestor = new QueueRequestor((QueueSession) session, managementQueue);
Message m = session.createMessage();
org.apache.activemq.artemis.api.jms.management.JMSManagementHelper.putOperationInvocation(m, ResourceNames.BROKER, "createAddress", queueName, RoutingType.ANYCAST.name());
Message reply = requestor.request(m);
ROOT_LOGGER.debugf("Creating address %s returned %s", queueName, reply);
if (!reply.getBooleanProperty("_AMQ_OperationSucceeded")) {
String body = reply.getBody(String.class);
if (!destinationAlreadyExist(body)) {
throw ROOT_LOGGER.remoteDestinationCreationFailed(queueName, body);
}
}
ROOT_LOGGER.debugf("Address %s has been created", queueName);
m = session.createMessage();
if (getSelector() != null && !getSelector().isEmpty()) {
org.apache.activemq.artemis.api.jms.management.JMSManagementHelper.putOperationInvocation(m, ResourceNames.BROKER, "createQueue", queueName, queueName, getSelector(), isDurable(), RoutingType.ANYCAST.name());
} else {
org.apache.activemq.artemis.api.jms.management.JMSManagementHelper.putOperationInvocation(m, ResourceNames.BROKER, "createQueue", queueName, queueName, isDurable(), RoutingType.ANYCAST.name());
}
Message reply = requestor.request(m);
ROOT_LOGGER.infof("Creating queue %s returned %s", queueName, reply);
reply = requestor.request(m);
ROOT_LOGGER.debugf("Creating queue %s returned %s", queueName, reply);
requestor.close();
if (!reply.getBooleanProperty("_AMQ_OperationSucceeded")) {
String body = reply.getBody(String.class);
if (!destinationAlreadyExist(body)) {
throw ROOT_LOGGER.remoteDestinationCreationFailed(queueName, body);
}
}
ROOT_LOGGER.infof("Queue %s has been created", queueName);
ROOT_LOGGER.debugf("Queue %s has been created", queueName);
}
}

Expand Down

0 comments on commit b3733d5

Please sign in to comment.