Add back autoCreate for bindingsQuery in AMQP protocol

This commit is contained in:
Martyn Taylor 2016-09-14 11:20:32 +01:00 committed by Clebert Suconic
parent 646a891988
commit dd32d6bb3e
1 changed files with 12 additions and 3 deletions

View File

@ -214,19 +214,28 @@ public class ProtonSessionIntegrationCallback implements AMQPSessionCallback, Se
if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateJmsQueues() && autoCreate) { if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateJmsQueues() && autoCreate) {
try { try {
serverSession.createQueue(new SimpleString(queueName), new SimpleString(queueName), null, false, true); serverSession.createQueue(new SimpleString(queueName), new SimpleString(queueName), null, false, true);
queueQueryResult = new QueueQueryResult(queueQueryResult.getName(), queueQueryResult.getAddress(), queueQueryResult.isDurable(), queueQueryResult.isTemporary(), queueQueryResult.getFilterString(), queueQueryResult.getConsumerCount(), queueQueryResult.getMessageCount(), queueQueryResult.isAutoCreateJmsQueues(), true);
} }
catch (ActiveMQQueueExistsException e) { catch (ActiveMQQueueExistsException e) {
// The queue may have been created by another thread in the mean time. Catch and do nothing. // The queue may have been created by another thread in the mean time. Catch and do nothing.
} }
queueQueryResult = new QueueQueryResult(queueQueryResult.getName(), queueQueryResult.getAddress(), queueQueryResult.isDurable(), queueQueryResult.isTemporary(), queueQueryResult.getFilterString(), queueQueryResult.getConsumerCount(), queueQueryResult.getMessageCount(), queueQueryResult.isAutoCreateJmsQueues(), true);
} }
return queueQueryResult; return queueQueryResult;
} }
@Override @Override
public boolean bindingQuery(String address) throws Exception { public boolean bindingQuery(String address) throws Exception {
BindingQueryResult queueQuery = serverSession.executeBindingQuery(SimpleString.toSimpleString(address)); BindingQueryResult bindingQueryResult = serverSession.executeBindingQuery(SimpleString.toSimpleString(address));
return queueQuery.isExists(); if (!bindingQueryResult.isExists() && bindingQueryResult.isAutoCreateJmsQueues()) {
try {
serverSession.createQueue(new SimpleString(address), new SimpleString(address), null, false, true);
}
catch (ActiveMQQueueExistsException e) {
// The queue may have been created by another thread in the mean time. Catch and do nothing.
}
bindingQueryResult = serverSession.executeBindingQuery(SimpleString.toSimpleString(address));
}
return bindingQueryResult.isExists();
} }
@Override @Override