<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JBossEAP5IntegrationwithTibcoEMS
</h3>
<span style="margin-bottom: 10px;">
modified by <a href="https://community.jboss.org/people/mattik">mattik</a> in <i>JBoss Messaging Development</i> - <a href="https://community.jboss.org/docs/DOC-14734">View the full document</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>This article highlights some of the basic steps required to integrate JBoss EAP 5 with TibcoEMS. This article should also work with JBoss EAP 4.x, however, I have not tested tested this at this time.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><div class="toc" style="border: 1px dashed black; padding: 10px;"><ul><ul><li>
<a class="jive-link-anchor-small" href="#Introduction">Introduction</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Credits">Credits</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#TibcoEMS_Configuration">TibcoEMS Configuration</a>
</li>
<ul><li>
<a class="jive-link-anchor-small" href="#Step1">Step1</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Step2">Step2</a>
</li>
</ul><li>
<a class="jive-link-anchor-small" href="#JBoss_Configuration">JBoss Configuration</a>
</li>
<ul><li>
<a class="jive-link-anchor-small" href="#Step1_538699">Step1</a>
</li>
<ul><li>
<a class="jive-link-anchor-small" href="#Option1">Option1</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Option2">Option2</a>
</li>
</ul><li>
<a class="jive-link-anchor-small" href="#Step2_634297">Step2</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Step3">Step3</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Step4">Step4</a>
</li>
</ul><li>
<a class="jive-link-anchor-small" href="#When_Using_a_Client">When Using a Client</a>
</li>
<ul><li>
<a class="jive-link-anchor-small" href="#Step1_23862">Step1</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Step2_408935">Step2</a>
</li>
</ul><li>
<a class="jive-link-anchor-small" href="#MDB_configuration">MDB configuration</a>
</li>
<ul><li>
<a class="jive-link-anchor-small" href="#MDB_Configuration_with_Automatic_Reconnection_">MDB Configuration with Automatic Reconnection </a>
</li>
<li>
<a class="jive-link-anchor-small" href="#How_to_make_the_sample_mdb_code_fully_recover_from_JMS_connection_issues">How to make the sample mdb code fully recover from JMS connection issues?</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#How_to_test_your_implementation_for_automatic_reconnectionrecovery_from_JMS_connection_issues">How to test your implementation for automatic reconnection/recovery from JMS connection issues?</a>
</li>
<ul><li>
<a class="jive-link-anchor-small" href="#Option1_567055">Option1</a>
</li>
<li>
<a class="jive-link-anchor-small" href="#Option2_909203">Option2</a>
</li>
</ul><li>
<a class="jive-link-anchor-small" href="#How_to_use_a_durable_topic_subscriber_instead_for_the_mdb">How to use a durable topic subscriber instead for the mdb?</a>
</li>
</ul></ul></ul></div></p><h2 id="Introduction"><span style="color: #800000;">Introduction</span></h2><p>This article differs from:</p><p><a class="jive-link-external-small" href="http://community.jboss.org/wiki/IntegrationWithTibcoEMS">IntegrationWithTibcoEMS</a> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and the TibcoEMS administration documents in the following:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><ul><li>Does not replace and remove JBoss messaging from the JBoss Installation (JBoss messaging can still be removed, but this is optional since the DefaultJMSProvider has not been replaced)</li><li>Defines a TIBCOJMSProvider</li><li>Provides a DLQ configuration without changing standardjboss.xml and replacing the DefaultJMSProvider with TIBCOJMSProvider</li><li>Has been tested on JBoss EAP 5</li><li>Uses authentication with Tibco EMS</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h2 id="Credits"><span style="color: #800000;">Credits</span></h2><p>The content in this page is based on TibcoEMS documentation for JBoss4.x. Some of the content has also been borrowed from the article:</p><p><a class="jive-link-external-small" href="http://community.jboss.org/wiki/IntegrationWithTibcoEMS">IntegrationWithTibcoEMS</a> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>including the sample mdb code for testing.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>A special thanks to Marjono Reksopuro, Susanta Mondal and Michael McKernan for their help with Tibco Administration, integration and testing for this configuration.</p><h2 id="TibcoEMS_Configuration"><span style="color: #800000;">TibcoEMS Configuration</span></h2><p>The steps in this section outline the steps required to create a test queue on TibcoEMS as well as the DLQ.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>* Please note this EMS configuration assumes the following:</strong></p><p><span style="font-size: 11pt; font-family: Calibri,Verdana,Helvetica,Arial;"> - Authorization enabled<br/> - Username/Password are set to: admin/admin  <br/> - A single instance running locally:   localhost with port of 7222.<br/> - If you need to have FT Pairs for failover, the url should be changed from   tcp://localhost:7222, tcp://localhost:7222  to  tcp://firstmachine:firstport,tcp://secondmachine:secondport<br/> <br/> </span></p><h3 id="Step1"><span style="color: #800000;">Step1</span></h3><p>Start the tibemsd server and the tibemsadmin console.</p><p>Queues and Connection Factories</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3 id="Step2"><span style="color: #800000;">Step2</span></h3><p>Create two queues (queue/myTestQueue and queue/DLQ) and two XA connection factories (TIBXAQueueConnectionFactory and TIBXATopicConnectionFactory), by entering the following commands in tibemsadmin:       <br/>    > connect</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    > create queue queue/myTestQueue</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    > create queue queue/DLQ</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    > create factory TIBXAQueueConnectionFactory <span style="font-size: 11pt; font-family: Calibri,Verdana,Helvetica,Arial;">xaqueue url=tcp://localhost:7222</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    > create factory TIBXATopicConnectionFactory xatopic <span style="font-size: 11pt; font-family: Calibri,Verdana,Helvetica,Arial;">url= tcp://localhost:7222</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Tibco pairs for Failover:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    > create factory TIBXAQueueConnectionFactory <span style="font-size: 11pt; font-family: Calibri,Verdana,Helvetica,Arial;">xaqueue url=tcp://localhost:7222, tcp://localhost:7222</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    > create factory TIBXATopicConnectionFactory <span style="font-size: 11pt; font-family: Calibri,Verdana,Helvetica,Arial;">xatopic url= tcp://localhost:7222, tcp://localhost:7222</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h2 id="JBoss_Configuration"><span style="color: #800000;">JBoss Configuration</span></h2><p>The steps in this section outline the steps required to configure JBoss to connect withTibcoEMS.</p><h3 id="Step1_538699"><span style="color: #800000;">Step1</span></h3><p>Add TIBCO EMS and the TIBCO EMS adapter class for JBoss to the CLASSPATH of the JBoss server. There are two options to accomplish this:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h4 id="Option1">Option1</h4><p>Add the following lines under the <server> element in the file $JBOSS_HOME/jboss-as/server/myinstance/conf/jboss-service.xml:</p><p><br/> <!-- TIBCO Enterprise Message Service classpath --></p><p><classpath codebase="file:/C:\tibco\ems\5.1\lib" archives="tibjms.jar" ></classpath></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h4 id="Option2">Option2</h4><p>Copy tibjms.jar file to:</p><p>$JBOSS_HOME/jboss-as/server/myinstance/lib</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3 id="Step2_634297"><span style="color: #800000;">Step2</span></h3><p>Create a new datasource file called tibco-jms-ds.xml or whatever name you prefer, and place it in:</p><p>$JBOSS_HOME/jboss-as/server/myinstance/deploy</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And add the following contents to the file mentioned above:</p><pre class="jive-pre"><code class="jive-code jive-xml">
<span class="jive-xml-tag"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="jive-xml-tag"><connection-factories></span>
<span class="jive-xml-comment"><!-- The Tibco JMS provider loader -->
<span class="jive-xml-tag"><mbean code="org.jboss.jms.jndi.JMSProviderLoader" name=":service=JMSProviderLoader,name=TibjmsProvider"></span>
      <span class="jive-xml-tag"><attribute name="ProviderName"></span>TIBCOJMSProvider<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"><attribute name="ProviderAdapterClass"></span>org.jboss.jms.jndi.JNDIProviderAdapter<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"><attribute name="QueueFactoryRef"></span>TIBXAQueueConnectionFactory<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"><attribute name="TopicFactoryRef"></span>TIBXATopicConnectionFactory<span class="jive-xml-tag"></attribute></span>
      <span class="jive-xml-tag"><attribute name="Properties"></span>
                java.naming.security.principal=admin
                java.naming.security.credentials=admin
                java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
                java.naming.factory.url.pkgs=com.tibco.tibjms.naming
                java.naming.provider.url=tcp://localhost:7222
      <span class="jive-xml-tag"></attribute></span>
<span class="jive-xml-tag"></mbean></span>
<!-- JMS XA Resource adapter, use this to get transacted JMS in beans --></span>
<span class="jive-xml-tag"><tx-connection-factory></span>
     <span class="jive-xml-tag"><jndi-name></span>TibcoXA<span class="jive-xml-tag"></jndi-name></span>
     <span class="jive-xml-tag"><xa-transaction/></span>
     <span class="jive-xml-tag"><rar-name></span>jms-ra.rar<span class="jive-xml-tag"></rar-name></span>
     <span class="jive-xml-tag"><connection-definition></span>org.jboss.resource.adapter.jms.JmsConnectionFactory<span class="jive-xml-tag"></connection-definition></span>
     <span class="jive-xml-tag"><config-property name="SessionDefaultType" type="java.lang.String"></span>javax.jms.Queue<span class="jive-xml-tag"></config-property></span>
     <span class="jive-xml-tag"><config-property name="JmsProviderAdapterJNDI" type="java.lang.String"></span>java:/TIBCOJMSProvider<span class="jive-xml-tag"></config-property></span>
     <span class="jive-xml-tag"><max-pool-size></span>20<span class="jive-xml-tag"></max-pool-size></span>
     <span class="jive-xml-tag"><security-domain-and-application></span>TibcoXARealm<span class="jive-xml-tag"></security-domain-and-application></span>
<span class="jive-xml-tag"></tx-connection-factory></span>
<span class="jive-xml-tag"></connection-factories></span>
</code></pre><h3 id="Step3"><span style="color: #800000;">Step3</span></h3><p>Notice that a security domain reference is present in the tibco-jms-ds.xml file. Therefore, modify the file $JBOSS_HOME/jboss-as/server/myinstance/conf/login-config.xml file as follows and add the TibcoXARealm within the <properties> element:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"><application-policy name="TibcoXARealm">
  <authentication>
      <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
        <module-option name="principal">admin</module-option>
        <module-option name="userName">admin</module-option>
        <module-option name="password">admin</module-option>
        <module-option name="managedConnectionFactoryName">jboss.jca:service=TxCM,name=TibcoXA</module-option>
      </login-module>
    </authentication>
</application-policy></code></pre><h3 id="Step4"><span style="color: #800000;">Step4</span></h3><p>When the JBoss server invokes JNDI and encounters the tibjmsnaming scheme, the server must be able to find the TIBCO Enterprise Message Service URLConnectionFactory. Therefore, modify the file $JBOSS_HOME/jboss-as/server/myinstance/conf/jndi.properties as follows:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Change:</p><p>java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces <br/> <br/> To<br/> java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:com.tibco.tibjms.naming</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h2 id="When_Using_a_Client"><span style="color: #800000;">When Using a Client</span></h2><h3 id="Step1_23862"><span style="color: #800000;">Step1</span></h3><p>When the client program invokes JNDI, it should use the TIBCO Enterprise Message Service JNDI server. Modify %JBOSS_CLIENT%\jndi.properties to use TIBCO Enterprise Message Service JNDI by setting the following property:    <br/> java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3 id="Step2_408935"><span style="color: #800000;">Step2</span></h3><p>Add EMS_HOME\lib\tibjms.jar to the CLASSPATH of the client program.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h2 id="MDB_configuration"><span style="color: #800000;">MDB configuration</span></h2><p><span>The sample mdb code from can be used:</span></p><p><a class="jive-link-external-small" href="http://community.jboss.org/wiki/IntegrationWithTibcoEMS">IntegrationWithTibcoEMS</a> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Update your jboss.xml file to look as follows:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"><?xml version="1.0"?>
<jboss>
   <resource-managers>
     <resource-manager>       
       <res-name>queuefactoryref</res-name>
       <res-jndi-name>java:/TibcoXA</res-jndi-name>
     </resource-manager>
   </resource-managers>
   <enterprise-beans>
     <message-driven>
       <ejb-name>SampleMDB</ejb-name>
       <configuration-name>Tibco Message Driven Bean</configuration-name>
       <destination-jndi-name>queue/myTestQueue</destination-jndi-name>
       <mdb-user>admin</mdb-user>
       <mdb-passwd>admin</mdb-passwd>
       <resource-ref>
         <res-ref-name>jms/QCF</res-ref-name>
         <resource-name>queuefactoryref</resource-name>
       </resource-ref>
     </message-driven>
   </enterprise-beans>
   <!-- container configuration for Tibco EMS -->
   <container-configurations>
     <container-configuration extends="Standard Message Driven Bean">
       <container-name>Tibco Message Driven Bean</container-name>
       <invoker-proxy-binding-name>tibco-message-driven-bean</invoker-proxy-binding-name>
     </container-configuration>
   </container-configurations>
   <!-- The JmsProviderAdapterJNDI must match the ProviderName in SERVER_HOME/deploy/tibco-jms-ds.xml file. -->   
   <invoker-proxy-bindings>
     <invoker-proxy-binding>
       <name>tibco-message-driven-bean</name>
       <invoker-mbean>default</invoker-mbean>
       <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
         <proxy-factory-config>
           <JMSProviderAdapterJNDI>TIBCOJMSProvider</JMSProviderAdapterJNDI>
           <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
           <MinimumSize>1</MinimumSize>
           <MaximumSize>15</MaximumSize>
           <KeepAliveMillis>30000</KeepAliveMillis>
           <MaxMessages>1</MaxMessages>
           <MDBConfig>
             <ReconnectIntervalSec>10</ReconnectIntervalSec>
             <DLQConfig>
               <DestinationQueue>queue/DLQ</DestinationQueue>
               <MaxTimesRedelivered>10</MaxTimesRedelivered>
               <TimeToLive>0</TimeToLive>
               <DLQUser>admin</DLQUser>
               <DLQPassword>admin</DLQPassword>
             </DLQConfig>
           </MDBConfig>
         </proxy-factory-config></proxy-factory>
       </invoker-proxy-binding>
     </invoker-proxy-bindings>
</jboss></code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>*Note: The above configuration uses an EJB2 configuration, for EJB3 the following annotations can be used:</p><pre class="jive-pre"><span style="font-family: courier new,courier; font-size: 12pt;"><code class="jive-code"></code></span><span style="font-family: courier new,courier; font-size: 12pt;">@ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:/TIBCOJMSProvider"),</span><br/><span style="font-family: courier new,courier; font-size: 12pt;">@ActivationConfigProperty(propertyName="DLQJNDIName", propertyValue="queue/DLQ"),<br/>@ActivationConfigProperty(propertyName="DLQUser", propertyValue="admin"),<br/>@ActivationConfigProperty(propertyName="DLQPassword",propertyValue="admin")</span><br/></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>Upon a restart of the JBoss instance, you shold have a working configuration.</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 8pt;"><em><span>----------------------- Below this line added by </span><a class="jive-link-email-small" href="mailto:matti.kaikkonen@teliasonera.com" target="_blank">matti.kaikkonen@teliasonera.com</a><span> Sept 13, 2012 --------------------------------</span></em></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3 id="MDB_Configuration_with_Automatic_Reconnection_"><span style="color: #800000;">MDB Configuration with Automatic Reconnection </span></h3><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>If you have had a problem with your JMS clients not reconnecting after bouncing EMS or losing network connection then you want to look into this option. The problem here is that the number of times to attempt to reconnect to the JMS provider needs a new property "reconnectAttempts" and by default it is 5.  This property is available from JBoss Application 5 GA.  Prior to this version, reconnection attempts were infinite by default. In the above format it is not possible to define the reconnectAttempts. I have tested this with JBoss 5.1.0GA.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Update your jboss.xml file to look as follows - replace the <span style="font-family: courier new,courier; font-size: 12pt;">invoker-proxy-binding <span style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">block with following. Look <a class="jive-link-wiki-small" href="https://community.jboss.org/docs/DOC-9352">here</a> for documentation.<br/></span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"><invoker-proxy-binding>
    <name>tibco-message-driven-bean</name>
    <invoker-mbean>default</invoker-mbean>
    <proxy-factory>org.jboss.ejb.plugins.inflow.JBossJMSMessageEndpointFactory</proxy-factory>
    <proxy-factory-config>
        <activation-config>
            <activation-config-property>
                <activation-config-property-name>providerAdapterJNDI</activation-config-property-name>
                <activation-config-property-value>TIBCOJMSProvider</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>minSession</activation-config-property-name>
                <activation-config-property-value>1</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>maxSession</activation-config-property-name>
                <activation-config-property-value>15</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>keepAlive</activation-config-property-name>
                <activation-config-property-value>30000</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>maxMessages</activation-config-property-name>
                <activation-config-property-value>1</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>reconnectInterval</activation-config-property-name>
                <activation-config-property-value>10</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>reconnectAttempts</activation-config-property-name>
                <activation-config-property-value>1000000</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>useDLQ</activation-config-property-name>
                <activation-config-property-value>true</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>DLQHandler</activation-config-property-name>
                <activation-config-property-value>org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>DLQJNDIName</activation-config-property-name>
                <activation-config-property-value>queue/DLQ</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>DLQUser</activation-config-property-name>
                <activation-config-property-value>admin</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>DLQPassword</activation-config-property-name>
                <activation-config-property-value>admin</activation-config-property-value>
            </activation-config-property>
            <activation-config-property>
                <activation-config-property-name>DLQMaxResent</activation-config-property-name>
                <activation-config-property-value>10</activation-config-property-value>
            </activation-config-property>
        </activation-config>
        <endpoint-interceptors>
            <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
            <interceptor>org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor</interceptor>
            <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
            <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
        </endpoint-interceptors>
    </proxy-factory-config>
</invoker-proxy-binding></code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3 id="How_to_make_the_sample_mdb_code_fully_recover_from_JMS_connection_issues"><span style="color: #800000;">How to make the sample mdb code fully recover from JMS connection issues?</span></h3><p><span style="color: #800000;"><br/></span></p><p><span style="color: #000000;">With the above change we have taken care of the message listener part so that the onMessage works after a disconnect. But the sendReply doesn't recover without some extra code. You need to catch the JMSException when sending the reply, and first close the session and connection (look at the ejbRemove), and then reconnect again (look at setup) before retrying to send the reply message.<br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h3 id="How_to_test_your_implementation_for_automatic_reconnectionrecovery_from_JMS_connection_issues"><span style="color: #800000;">How to test your implementation for automatic reconnection/recovery from JMS connection issues?</span></h3><h4 id="Option1_567055">Option1</h4><p>If you don't have access to a TIBCO EMS server that you can bounce or kill anytime then here is one possible way to test it. The idea is to manipulate the routing table of the linux or windows workstation where you run your JBoss and in that way simulate a loss of connectivity. Here are examples that I have used.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>Linux:</strong> if the ip address of the TIBCO EMS server is 192.168.1.38 then</p><p>Simulate network issue</p><p><strong>route add -net 192.168.1.38 netmask 255.255.255.255 reject</strong></p><p>Recover connectivity<strong><br/></strong></p><p><strong>route del -net 192.168.1.38 netmask 255.255.255.255 reject</strong></p><p>This works also - in my case eth0 device is connected and eth1 is WLAN that is disconnected<br/><strong>route add -net 192.168.1.38 netmask 255.255.255.0 dev eth1</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>Windows7</strong><strong>:</strong> if the ip address of the TIBCO EMS server is 192.168.1.38 then</p><p>Simulate network issue</p><p><strong>route ADD 192.168.1.38 MASK 255.255.255.255 169.254.138.21                </strong># where 169.254.138.21 is my VMware Network Adapter Autoconfiguration address <strong><br/></strong></p><p>Recover connectivity<strong><br/></strong></p><p><strong>route DELETE 192.168.1.38</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><h4 id="Option2_909203">Option2</h4><p>If you can bounce or kill TIBCO EMS then either do a clean shutdown (CTRL-C in the EMS console does that) or use kill -9 / Task Manager>End Process to simulate a crash.</p><h3 id="How_to_use_a_durable_topic_subscriber_instead_for_the_mdb"><span style="color: #800000;">How to use a durable topic subscriber instead for the mdb?</span></h3><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="color: #000000;">To use the sample mdb code (change also reply to destination from queue to topic) you just need to change all references to queues to topics. That's not a problem. </span><span style="color: #000000;">The configuration of jboss.xml and ejb-jar.xml is the trickier part. In the jboss.xml replace <resource-managers> and <enterprise-beans> blocks with following. This is tested with JBoss 5.1.0GA.<br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"><resource-managers>
        <resource-manager>       
            <res-name>topicfactoryref</res-name>
            <res-jndi-name>java:/TibcoXA</res-jndi-name>
        </resource-manager>
</resource-managers>
<enterprise-beans>
        <message-driven>
            <ejb-name>SampleMDB</ejb-name>
            <configuration-name>Tibco Message Driven Bean</configuration-name>
            <destination-jndi-name>topic/B</destination-jndi-name>
            <mdb-user>admin</mdb-user>
            <mdb-passwd>admin</mdb-passwd>
            <mdb-subscription-id>SampleMDB</mdb-subscription-id>
            <mdb-client-id>123</mdb-client-id>
            <resource-ref>
                <res-ref-name>jms/TCF</res-ref-name>
                <resource-name>topicfactoryref</resource-name>
            </resource-ref>
        </message-driven>
</enterprise-beans></code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And the following replaces the original ejb-jar.xml.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code"><?xml version="1.0"?>
<!DOCTYPE ejb-jar
   PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
   "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
    <enterprise-beans>
        <message-driven>
            <ejb-name>SampleMDB</ejb-name>
            <ejb-class>com.unisys.tibcojboss.mdb.SampleMDB</ejb-class>
            <transaction-type>Container</transaction-type>
            <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
            <message-driven-destination>
                <destination-type>javax.jms.Topic</destination-type>
                <subscription-durability>Durable</subscription-durability>
            </message-driven-destination>
            <resource-ref>
                <res-ref-name>jms/TCF</res-ref-name>
                <res-type>javax.jms.TopicConnectionFactory</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </message-driven>
    </enterprise-beans>
</ejb-jar></code></pre></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Comment by <a href="https://community.jboss.org/docs/DOC-14734">going to Community</a></p>
        <p style="margin: 0;">Create a new document in JBoss Messaging Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2043">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>