3 Replies Latest reply on Apr 19, 2006 9:34 AM by stevech10

    Problem publishing messages to a remote Queue

    stevech10

      I have a JBoss 4.0.3 JMS system that publishes and consumes JMS messages to and from a remote JBoss server that has both a topic and a queue. I have the consuming part working OK where I have a MDB on my local server consuming messages from the remote topic, however, I am having problems getting my session bean on my local server to publish messages to the queue on the remote server (a session bean on the remote server is able to publish to the remote queue on the same machine, but not the local instance). I am implementing a request/response design with a temporary queue on the local server that I want the remote server to respond to following receipt of the message.

      Could anyone provide instructions, or a working link, on how to configure/deploy JBoss to publish to the remote queue. I have the code working for the local instance, so I do not believe my problems are there but in the JBoss configuration or deployment descriptors. I do not get any exceptions to provide you with.

        • 1. Re: Problem publishing messages to a remote Queue
          jaikiran

          Post the code where you are looking up the remote queue in your session bean. I believe its mainly got to do with the InitialContext properties.

          • 2. Re: Problem publishing messages to a remote Queue
            stevech10

            Thank you for your interest.

            Here is the initial context lookup - although I was hoping not to have to hard code this:

            Properties properties = new Properties();
            properties.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            properties.put(Context.URL_PKG_PREFIXES,
            "org.jboss.naming:org.jnp.interfaces");
            properties.put(Context.PROVIDER_URL, URL_NAME);
            jndiContext = new InitialContext(properties);


            Also, here's my JMS loader provider from jms-ds.xml (remoteserver replaced with actual server):


            QueuehostJMSProvider
            org.jboss.jms.jndi.JNDIProviderAdapter
            <!-- The combined connection factory -->
            XAConnectionFactory
            <!-- The queue connection factory -->
            XAConnectionFactory
            <!-- The topic factory -->
            XAConnectionFactory
            <!-- Connect to JNDI on the host "queuehost" port 1099 -->

            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.factory.url.pkgs=org.jnp.interfaces
            java.naming.provider.url=remoteserver:1099



            Finally, I have a remote proxy binding setup up in jboss.xml that I successfully invoke to consume from a remote topic. I was hoping I could use the same proxy binding to publish to the remote queue:

            <invoker-proxy-bindings>
            <invoker-proxy-binding>
            my-mdb-invoker
            <invoker-mbean>does-not-matter</invoker-mbean>
            <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
            <proxy-factory-config>
            QueuehostJMSProvider
            StdJMSPool
            1
            30000
            15
            1

            10

            queue/DLQ
            10
            0


            </proxy-factory-config>
            </invoker-proxy-binding>
            </invoker-proxy-bindings>

            • 3. Re: Problem publishing messages to a remote Queue
              stevech10

              Sorry, I noticed the invoked binding and JMS remote loader did not paste correctly, here they are again:

              JMS remote loader in jmd-ds.xml:

              <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
               name="jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=purple05.ed.ray.com">
               <attribute name="ProviderName">QueuehostJMSProvider</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 "queuehost" 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=purple05.ed.ray.com:1099
               </attribute>
               </mbean>
              



              Proxy binding in jboss.xml:

              <invoker-proxy-bindings>
               <invoker-proxy-binding>
               <name>my-mdb-invoker</name>
               <invoker-mbean>does-not-matter</invoker-mbean>
               <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
               <proxy-factory-config>
               <JMSProviderAdapterJNDI>QueuehostJMSProvider</JMSProviderAdapterJNDI>
               <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
               <MinimumSize>1</MinimumSize>
               <KeepAliveMillis>30000</KeepAliveMillis>
               <MaximumSize>15</MaximumSize>
               <MaxMessages>1</MaxMessages>
               <MDBConfig>
               <ReconnectIntervalSec>10</ReconnectIntervalSec>
               <DLQConfig>
               <DestinationQueue>queue/DLQ</DestinationQueue>
               <MaxTimesRedelivered>10</MaxTimesRedelivered>
               <TimeToLive>0</TimeToLive>
               </DLQConfig>
               </MDBConfig>
               </proxy-factory-config>
               </invoker-proxy-binding>
               </invoker-proxy-bindings>
              


              And here's the initial context lookup:

               Properties properties = new Properties();
               properties.put(Context.INITIAL_CONTEXT_FACTORY,
               "org.jnp.interfaces.NamingContextFactory");
               properties.put(Context.URL_PKG_PREFIXES,
               "org.jboss.naming:org.jnp.interfaces");
               properties.put(Context.PROVIDER_URL, URL_NAME);
               jndiContext = new InitialContext(properties);