2 Replies Latest reply on Feb 18, 2003 8:07 PM by razvanm

    Doubts about MDB as a Topic Subscriber

    mekatoka

      Hi,
      I implemented a Topic, where an application client is listening to a Topic, and the message is being published by an ejb on a server. In this scenario i wrote a message listener class on the client side, i had a start listener method, in which i would do the lookup, create topic connection and start the listener. And the start listener method had to be called/invoked, then only the client would listen to the topic.

      If i wanted a MDB to listen to topic, do i need the startlistener method ??

      if Yes, who invokes the method ?
      if NO, does it mean the MDB is directly bound to the topic ?

      Now MDB has an OnMessage() method, in which we write what to do after u get the message ? But my question is how to bind the topic in the first place ?

      I know that we can do the settings in the ejb-jar.xml where in you would give the message destination and all. But what about the lookup ? It needs to know the ip address of the topic destination from where it needs to retirieve.

      Can some body guide me if i am missing something ?

      TIA

      Meka Toka

        • 1. Re: Doubts about MDB as a Topic Subscriber
          mekatoka

          Hi,

          found the answer to above Q

          plz refer to

          http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=11&t=004466

          cheers

          Meka Toka

          • 2. Re: Doubts about MDB as a Topic Subscriber
            razvanm

            It does work and beautifully so, I tried to post the modified xml files for you but this form thingy doesn't let me...there are some posts around but not very complete, you need some configuration changes.
            1. jboss.xml add <configuration-name>Remote JMS Server</configuration-name> to your message driven bean.
            2. go to conf/standardjboss.xml, look for a container configuration for "Standard Message Driven Bean". Take that whole configuration starting at <container-configuration> and copy it below. Change "Standard...." to "Remote JMS Server" to match your jboss.xml at(1). Then go and change the value of JMSProviderAdapterJNDI to RemoteJMSServer.
            3. go to /deploy jms-service.xml. Make a copy of the jms provider loader group. Now change name="JBossMQProvider" with name="RemoteJMSProvider" the attribute text for ProviderName from JBossMQProvider to RemoteJMSProvider,
            add this: remote:1099, take out leading "java:/" from the Queue and Topic factory ref.

            That's it.
            The remote JMS server must be running when the JBoss server containing the MDB's start! If the remote server goes down, the MDB tries to reconnect, but it might fail (bug in 3.04)