5 Replies Latest reply on May 3, 2011 3:18 PM by Priya Srihari

    How to configure jms-jca-provider to listen a remote queue with jndi in JBoss-esb?

    koten ou Newbie

      Hello everyone!

       

      I'm configuring a transactional provider for my project that, I used jms-jca-provider with XAConnection, but it seems no accept for the remote queue configured in jndi.

      And I found the webpage:http://www.redhat.com/docs/manuals/jboss/jboss-soa-4.2/html-single/SOA_Release_Notes/readme.html#id2577304

       

      ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

      To enable a jms-jca-provider to talk to queues on other nodes you will need to use a provider adapter.

      You will need to define an MBean representing the provider adapter, for example:

      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
              name="jboss.esb:service=JMSProviderLoader,name=RemoteJMSProvider,server=remote">
          <attribute name="ProviderName">remoteProvider</attribute>
          <attribute name="ProviderAdapterClass">
              org.jboss.jms.jndi.JNDIProviderAdapter
          </attribute>
          <!-- The queue connection factory -->
          <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
          <!-- The topic factory -->
          <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
          <!-- Connect to JNDI on the host "remote" port 1099 -->
          <attribute name="Properties">
            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.factory.url.pkgs=org.jnp.interfaces
            java.naming.provider.url=remote:1099
          </attribute>
      </mbean>
      This MBean should be defined in ha-jndi.xml on the node where the queue is really deployed

      Then, in the definition of the jms-jca-provider you need to add a providerAdapterJNDI attribute, e.g:

      providerAdapterJNDI="java:/remoteProvider"
      The JCA adapter will use the provider adapter from JNDI to create the JNDI context.

      ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

       

      But I can't find the "ha-jndi.xml" in my Jboss AS ,"jbossesb-server-4.7".

      1.Could you please tell me where it is or into where I should configure the MBean?

      2.Could you please tell me where the jms-jca-provider be defined or into where I shoud configure the providerAdapterJNDI attribute?

       

      thank you all!

      regards


        • 1. Re: How to configure jms-jca-provider to listen a remote queue with jndi in JBoss-esb?
          Daniel Bevenius Master

          Hi,

           

          attached to this jira are examples of this. Take a look at them and see if this solves your issues.

           

          Regards,

           

          /Daniel

          • 2. Re: How to configure jms-jca-provider to listen a remote queue with jndi in JBoss-esb?
            koten ou Newbie

            Hi Daniel

             

            Thank you for your reply !

             

            I'm studying your example,but it seems a bit difficult to me as a fresher...sorry

             

            In step 1, I think it is to deploy a queue for message ,and I success in it.

             

            In step 2 , could you please tell me how to deploy the remote-jmsprovider-service.xml in my jbossesb server(jbossesb-server-4.7)?

            (e.g. where I put this xml-file?)

             

            In step 3, I think it is to deploy a esb service which listens to the queue defined in step 1

             

            If there is anything wrong about my understanding, could you please correct me or give me any advice?

             

            thank you

             

             

            BTW: If not mind , could you please give me in preventing message loss when stop the esb service or jboss service ?

            thank you again.

             

            regards!

            • 3. Re: How to configure jms-jca-provider to listen a remote queue with jndi in JBoss-esb?
              Daniel Bevenius Master

              Hi,

               

              In step 1, I think it is to deploy a queue for message ,and I success in it.

              You are correct. You deploy the queue to the one server, lets call it server1

               

              In step 2 , could you please tell me how to deploy the remote-jmsprovider-service.xml in my jbossesb server(jbossesb-server-4.7)?

              (e.g. where I put this xml-file?)

              You deploy this to the different server, lets call it server2,  by putting it in you server 'deploy' directory.

               

              In step 3, I think it is to deploy a esb service which listens to the queue defined in step 1

              Yep, you are right. You deploy the esb service to the server2.

               

              BTW: If not mind , could you please give me in preventing message loss when stop the esb service or jboss service ?

              thank you again.

              If you use JMS as you transport and use persistent JMS message, which is the default in jbossesb, you should not experience message loss. Note that message loss is possible when using the invm transport, see the ProgrammerGuide for more information about this.

               

               

              Regards,

               

              /Daniel

              • 4. Re: How to configure jms-jca-provider to listen a remote queue with jndi in JBoss-esb?
                koten ou Newbie

                Hi Daniel

                 

                Thanks a lot for your detailed reply, and I'v been successed in configure it with remote queue.

                 

                And your advice made me find that, the "InVM" is the origin of my message loss.

                 

                Thank you very much!

                • 5. How to configure jms-jca-provider to listen a remote queue with jndi in JBoss-esb?
                  Priya Srihari Newbie

                  Hello Daniel

                   

                  I'm trying to configure something similar, only in this case, I have the client  and server JBoss AS (4.3GA) configured on two different nodes. The server JBoss AS is clustered between busnodes 1 & 2. The client JBoss AS is on webnode1.

                  The Server instance has in its deploy/hajndi-jms-ds.xml:

                  <mbean code="org.jboss.jms.jndi.JMSProviderLoader"

                           name="jboss.jms:service=JMSProviderLoader,name=HAJNDIJMSProvider">

                      <attribute name="ProviderName">DefaultJMSProvider</attribute>

                      <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

                      <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>

                      <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>

                      <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>

                      <attribute name="Properties">

                      </attribute>

                    </mbean>

                  <tx-connection-factory>

                      <jndi-name>JmsXA</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:/DefaultJMSProvider</config-property>

                      <max-pool-size>20</max-pool-size>

                      <security-domain-and-application>JmsXARealm</security-domain-and-application>

                      <track-connection-by-tx/>

                    </tx-connection-factory>

                   

                  Also the Server deploy directly has jboss-messaging-sar in which there is connection-factories-service.xml defined with entries for clustered and non-clustered connections as follows :

                  <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"

                        name="jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"

                        xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">

                        <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>

                        <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>

                        <depends>jboss.messaging:service=PostOffice</depends>

                   

                        <attribute name="JNDIBindings">

                           <bindings>

                              <binding>/ClusteredConnectionFactory</binding>

                              <binding>/ClusteredXAConnectionFactory</binding>

                              <binding>java:/ClusteredConnectionFactory</binding>

                              <binding>java:/ClusteredXAConnectionFactory</binding>

                           </bindings>

                        </attribute>

                   

                        <attribute name="SupportsFailover">true</attribute>

                        <attribute name="SupportsLoadBalancing">true</attribute>

                     </mbean>

                   

                  From the client JBoss instance I want to be able to send messages to a queue on the server JBoss instance using the clustered connection - ClusteredConnectionFactory. I get the error - ClusteredConnectionFactory not bound. From my java code, i initialize the context with the server url and cluster port:1100 , this doesnt seem to work.

                   

                  Please let me know what needs to be changed to get this to work.

                   

                  Thanks

                  Priya