Destination dest = jmsResourceFactory.lookupDestination(queueName);
if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
// In this mode, the queue must not already exist as we are creating it
if (dest != null) {
throw new JMSBindingException(queueType + queueName
+ " already exists but has create mode of \""
+ qCreateMode
+ "\" while registering binding "
+ jmsBinding.getName()
+ " invoker");
}
// Create the queue
dest = jmsResourceFactory.createDestination(queueName);
} else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
// In this mode, the queue may nor may not exist. It will be created if it does not exist
// but don't create when using jms:jndi uri format
if (dest == null && !"jndi".equals(jmsBinding.getDestinationType())) {
dest = jmsResourceFactory.createDestination(queueName);
}
} else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
// In this mode, the queue must have already been created.
if (dest == null) {
throw new JMSBindingException(queueType + queueName
+ " not found but create mode of \""
+ qCreateMode
+ "\" while registering binding "
+ jmsBinding.getName()
+ " invoker");
}
}
// Make sure we ended up with a queue
if (dest == null) {
throw new JMSBindingException(queueType + queueName
+ " not found with create mode of \""
+ qCreateMode
+ "\" while registering binding "
+ jmsBinding.getName()
+ " invoker");