Restricting DMLC_102 from connecting to the secondary EMS server in standby mode
Environment:
Spring : 2.5.6
Weblogic : 8.1 SP4
jdk : 1.4
Tibco EMS server
The configuration below works perfectly for the failover scenario of connecting automatically to failed over server.
But, as i have given the Primary and Secondary EMS server URL details in the JNDI configuration. Spring's DMLC_102 is trying to connect even to the secondary server which is in standby mode.
When i changed the configuration to use TibjmsQueueConnectionFactory in the targetConnectionFactory parameter with the reconnAttemptCount set as 100 the failover scenario is not working.
Is there a way to configure Spring's DMLC_102 to refrain from trying to connect to the Secondary server in standby mode?
Code:
<bean id="jmsMessageListener" class="org.springbyexample.jms.JmsMessageListener">
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
weblogic.jndi.WLInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
t3://localhost:7001
</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="proxyInterface" value="javax.jms.QueueConnectionFactory" />
<property name="lookupOnStartup" value="true" />
<property name="cache" value="false" />
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>ConnectionFactory</value>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>Datasource</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="newJmsQueueConnectionFactory"
class="com.tibco.tibjms.TibjmsQueueConnectionFactory">
<property name="serverUrl">
<value>${primaryServerUrl},${secondaryServerUrl}</value>
</property>
<property name="reconnAttemptCount">
<value>100</value>
</property>
<property name="reconnAttemptDelay">
<value>5000</value>
</property>
</bean>
<bean id="credentialsConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="jmsQueueConnectionFactory" />
<!--<property name="targetConnectionFactory" ref="newJmsQueueConnectionFactory" />-->
<property name="username" value="abcd">
</property>
<property name="password" value="abcd">
</property>
</bean>
<bean id="jmsFeedContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer102">
<property name="transactionManager" ref="transactionManager" />
<property name="connectionFactory" ref="credentialsConnectionFactory" />
<property name="destinationResolver" ref="destinationResolver" />
<property name="destinationName" value="org.springbyexample.jms.test" />
<property name="messageListener" ref="jmsMessageListener" />
<property name="recoveryInterval" value="10000" />
</bean>
<bean id="destinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
</bean>