2 Replies Latest reply on Oct 27, 2011 8:46 AM by S V

    Subscribing to multiple topics (Including Remote Topics)

    S V Newbie



      I am a total newbie to JMS (Jboss 6 and HornetQ also)


      I tried hands on some JMS example using JBoss AS 6.0.0Final and HornetQ and also tried on creating a MDB for receiving messages posted to the Topic subscribed.


      I want to know the following to get further in the same:

      1. If it is possible to subscribe to the remote Topics (Topics that are deployed on a remote Jboss AS)?

      2. Can single MDB subscribe and receive messages from multiple Topics?


      Any help would be appreciated!!





        • 1. Re: Subscribing to multiple topics (Including Remote Topics)
          Wolf-Dieter Fink Master

          1. Yes, need to specify the remote JNDI, depend on the EJB spec you implement

          2. No, single MDB provides a onMessage() that listen on one queue/topic

          • 2. Re: Subscribing to multiple topics (Including Remote Topics)
            S V Newbie

            Hi Wolf-Dieter


            Thanks for the response.


            Regarding (1) I followed the steps to subsribe to the remote Topic on Jboss

            I am able to post messages and consume them using a standalone client with the following properties




            props.put(Context.PROVIDER_URL, "jnp://<reemote_host>1099");


            I want the same to be possible through an MDB wherein the details are as under


            Annotations on MyMDB

            @MessageDriven(name = "MDBExample", activationConfig = {

            @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),

            @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/testTopic"),

            @ActivationConfigProperty(propertyName = "providerAdapterJNDI", propertyValue="java:/RemoteJMSProvider")



            In File $JBOSS_HOME/server/default/deploy/hornetqjms-ds.xml

            <!-- Remote JMS Provider -->

               <mbean code="org.jboss.jms.jndi.JMSProviderLoader" hornetq:service=JMSProviderLoader,name=RemoteJMSProvider,server=<rremote_host>">

                  <attribute name="ProviderName">RemoteJMSProvider</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">








            after this configuration I post messages to the reremote topic using my standalone client.

            But the messages are not delivered to the MDB (on My local Jboss6)


            Is there any place else that I need to configure something?