tags:

views:

100

answers:

0

Our application uses activemq for one of its modules and depending upon the customer, it should either uses the activemq for message publishing/subscribing or not use it.

We have the activemq connection property like the activemq url and port etc. coming from a DB. For customers not using that module, it is empty.

We have defined the configuration like this

<bean id="producerTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory">
         <ref bean="jmsConnectionFactory" />
    </property>
</bean>

<bean id="jmsManagedConnectionFactory" class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
    <property name="resourceAdapter" ref="activeMQResourceAdapter" />

</bean>

<bean id="jmsConnectionFactory" class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory" ref="jmsManagedConnectionFactory" />
    <property name="connectionManager" ref="jmsConnectionManager" />
</bean>

<bean id="jmsConnectionManager" class="org.jencks.factory.ConnectionManagerFactoryBean"> 
    <property name="transactionManager" ref="jtxManager" /> 
</bean>
<bean id="jtxManager"  class="org.jencks.factory.TransactionManagerFactoryBean" />

<bean id="jencks" class="org.jencks.JCAContainer">
    <!--
        lets use the default bootstrap context 
    --> 
    <property name="transactionManager" ref="jtxManager" /> 

    <!-- the JCA Resource Adapter -->
    <property name="resourceAdapter">
        <ref bean="activeMQResourceAdapter" />
    </property>
</bean>

<bean id="activeMQResourceAdapter" class="com.xyz.activemq.resouce.adapter.ActiveMQResourceAdapterWrapper" init-method="init">
    <property name="serverUrl" value="" />
</bean>

ActiveMQResourceAdapterWrapper class sets the serverURL reading it from DB.

But for cases where we don't need the module using activemq, we keep on getting the following error and it builds up the log

2010-04-02 15:01:59,086 ERROR [org.apache.activemq.ra.ActiveMQEndpointWorker] (pool-4-thread-1) Failed to connect to broker []: Could not create Transport. Reason: java.io.IOException: Transport not scheme specified: []

Is there a way to configure a conditional connection property to avoid the connection retries infinitely?