String qCreateMode = jmsBinding.getDestinationCreate();
if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
// In this mode, the queue must not already exist as we are creating it
if (destination != null) {
throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
+ " already exists but has create mode of \""
+ qCreateMode
+ "\" while registering service "
+ service.getName()
+ " listener");
}
// Create the queue
destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
} 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
if (destination == null) {
destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
}
} else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
// In this mode, the queue must have already been created.
if (destination == null) {
throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
+ " not found but create mode of \""
+ qCreateMode
+ "\" while registering service "
+ service.getName()
+ " listener");
}
}
// Make sure we ended up with a queue
if (destination == null) {
throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
+ " not found with create mode of \""
+ qCreateMode
+ "\" while registering service "
+ service.getName()
+ " listener");