protected void createConnection ( ) throws JMSException { if ( connection == null ) { if ( ! endpointConfiguration . isPubSubDomain ( ) && endpointConfiguration . getConnectionFactory ( ) instanceof QueueConnectionFactory ) { connection = ( ( QueueConnectionFactory ) endpointConfiguration . getConnectionFactory ( ) ) . createQueueConnection ( ) ; } else if ( endpointConfiguration . isPubSubDomain ( ) && endpointConfiguration . getConnectionFactory ( ) instanceof TopicConnectionFactory ) { connection = ( ( TopicConnectionFactory ) endpointConfiguration . getConnectionFactory ( ) ) . createTopicConnection ( ) ; connection . setClientID ( getName ( ) ) ; } else { log . warn ( "Not able to create a connection with connection factory '" + endpointConfiguration . getConnectionFactory ( ) + "'" + " when using setting 'publish-subscribe-domain' (=" + endpointConfiguration . isPubSubDomain ( ) + ")" ) ; connection = endpointConfiguration . getConnectionFactory ( ) . createConnection ( ) ; } connection . start ( ) ; } }
Create new JMS connection .