Remote ConnectionFactory/Queue reconnection
gquintana Mar 10, 2005 9:22 AMHello,
I am sending message from JBoss EJB Session to a remote JBoss Queue. I have declared the remote JBossMQ like this:
<?xml version="1.0" encoding="UTF-8"?> <connection-factories> <mbean code="org.jboss.naming.ExternalContext" name="jboss.jndi:service=ExternalContext,jndiName=external/RemoteJBoss"> <attribute name="JndiName">java:external/RemoteJBoss</attribute> <attribute name="CacheContext">true</attribute> <attribute name="Properties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://remoteserver:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces <attribute name="InitialContext">javax.naming.InitialContext</attribute> </attribute> <attribute name="RemoteAccess">true</attribute> </mbean> <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader,name=JMSExploitationProvider"> <attribute name="ProviderName">JMSExploitationProvider</attribute> <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute> <attribute name="FactoryRef">XAConnectionFactory</attribute> <attribute name="QueueFactoryRef">XAConnectionFactory</attribute> <attribute name="TopicFactoryRef">XAConnectionFactory</attribute> <attribute name="Properties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://remoteserver:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces </attribute> </mbean> <tx-connection-factory> <jndi-name>JMSExploitationXA</jndi-name> <xa-transaction/> <rar-name>jms-ra.rar</rar-name> <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition> <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property> <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/JMSExploitationProvider</config-property> <max-pool-size>20</max-pool-size> </tx-connection-factory> </connection-factories>
Sending a message from the local JBoss to the remote one basically works perfectly.
Nonetheless, when I stop and restart the remote JBoss, the local JBoss doesn't find the new remote ConnectionFactory/Queue because they are not refreshed: is there a cache somewhere?.
Then if use the local JBoss web console to invoke JNDIView.list, the external context is refreshed (is the cache refreshed by this operation?) and everything works back again.
What can I do avoid this trick on the local JBoss each the remote JBoss is restarted and make the reconnection automatic?
Thanks for your help,
Gérald