下面的代码在 Wildfly 9.0.1 的运行时创建 JMS 队列,没有问题。在 Wildfly 10 和 11 中,hornetq-server 被替换为 activemq。如何正确地将其迁移到 Wildfly 10/11?谢谢你。
private boolean createQueue(String operationName, String queueName) {
boolean result = false;
ModelControllerClient client = qService.getModelControllerClient();
if(client != null){
ModelNode operation = new ModelNode();
ModelNode address = operation.get(ClientConstants.OP_ADDR);
address.add("subsystem", "messaging");
address.add("hornetq-server", "default");
address.add("jms-queue", queueName);
ModelNode entries = operation.get("entries");
entries.add("jms/queue/" + queueName);
operation.get(ClientConstants.OP).set(operationName);
try {
ModelNode returnVal = client.execute(operation);
return returnVal.get("outcome").asString().equalsIgnoreCase("success");
} catch (Exception e) {
DLOG.error(ExceptionUtils.getStackTrace(e));
} finally {
try {
client.close();
} catch (IOException ex) {
DLOG.error(ExceptionUtils.getStackTrace(ex));
}
}
}
return result;
}