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 " + queueName
+ " already exists but has create mode of \""
+ qCreateMode
+ "\" while registering service "
+ serviceName
+ " listener");
} // end if
// Create the queue
destination = 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 (destination == null && !"jndi".equals(jmsBinding.getDestinationType())) {
destination = jmsResourceFactory.createDestination(queueName);
} // end if
} 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 " + queueName
+ " not found but create mode of \""
+ qCreateMode
+ "\" while registering service "
+ serviceName
+ " listener");
} // end if
} // end if
// Make sure we ended up with a queue
if (destination == null) {
throw new JMSBindingException("JMS Destination " + queueName
+ " not found with create mode of \""
+ qCreateMode
+ "\" while registering service "
+ serviceName
+ " listener");
} // end if
// Make sure its the expected type (queue or topic)
String type = (destination instanceof Queue) ? JMSBindingConstants.DESTINATION_TYPE_QUEUE : JMSBindingConstants.DESTINATION_TYPE_TOPIC;
if ("jndi".equals(jmsBinding.getDestinationType())) {
jmsBinding.setDestinationType(type);
} else {
if (!type.equals(jmsBinding.getDestinationType())) {
throw new JMSBindingException("JMS Destination " + queueName
+ " expecting type of "
+ jmsBinding.getDestinationType()
+ " but found "
+ type
+ " while registering service "