1 2 Previous Next 17 Replies Latest reply on Feb 20, 2004 9:48 PM by npdavis

    MDB on queue from external context

    sozonnik

      Hello !
      On server 1 I have external JNDI context (server 2, bind with ExternalContext MBean) with Queue bound to it on server 2.

      Is it possible to deploy MDB on server 1 that it listen queue on server 2 ? Simply deploy MDB with external context specified, don't work because when i specify
      <destination-jndi-name>/ext/engine/queue/A</destination-jndi-name>
      MDB binds to queue/ext/engine/queue/A

        • 1. Re: MDB on queue from external context

          I've posted this a couple of times over the
          last couple weeks.

          You have to add your own provider to
          jms-service.xml then tell the MDB to use it.
          The key part is the ProviderUrl attribute
          to get the remote jndi.

          Regards,
          Adrian

          • 2. Re: MDB on queue from external context

            Hi,

            I got the same problem. I tried your advice already. I added a provider and added the correct Provider there. If I shut down the other (external) boss I can see some exceptions which tells me that the connection was refused. The problem now is that my MDB on the local jboss can not resolve the topic name. If I write a test case and send a message to the external jboss, I can see that the topic is up and running there.
            Did I miss something? Could you post a sample?

            regards,

            Guido

            • 3. Re: MDB on queue from external context
              • 4. Re: MDB on queue from external context

                Hi,

                this is exactly what I did but I still get a JMSException that the topic is not bound. If I define the same topic localy I do not get this exception but also never receives a message from the remote topic.
                at the jboss.xml I got a section :
                <container-configurations>
                <container-configuration>
                <container-name>My Config</container-name>
                <call-logging>false</call-logging>
                <container-invoker>org.jboss.ejb.plugins.jms.JMSContainerInvoker</container-invoker>
                <container-interceptors>
                org.jboss.ejb.plugins.LogInterceptor
                org.jboss.ejb.plugins.RunAsSecurityInterceptor
                <!-- CMT -->

                org.jboss.ejb.plugins.TxInterceptorCMT
                org.jboss.ejb.plugins.MetricsInterceptor
                org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
                <!-- BMT -->

                org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
                org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
                org.jboss.ejb.plugins.MetricsInterceptor org.jboss.resource.connectionmanager.CachedConnectionInterceptor
                </container-interceptors>
                <client-interceptors>

                org.jboss.proxy.ejb.HomeInterceptor
                org.jboss.proxy.SecurityInterceptor
                org.jboss.proxy.TransactionInterceptor
                org.jboss.invocation.InvokerInterceptor


                new org.jboss.proxy.ejb.StatelessSessionInterceptor
                org.jboss.proxy.SecurityInterceptor
                org.jboss.proxy.TransactionInterceptor
                org.jboss.invocation.InvokerInterceptor

                </client-interceptors>
                <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
                <instance-cache/>
                <persistence-manager/>
                <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
                <container-invoker-conf>
                RemoteJMSProvider
                StdJMSPool
                15
                1

                10

                queue/DLQ
                10
                0


                </container-invoker-conf>
                <container-pool-conf>
                100
                </container-pool-conf>
                </container-configuration>
                </container-configurations>

                At this config is the
                RemoteJMSProvider

                tag which is my remote provider from jms-service.xml.
                Is this wrong?

                tnaks! regards,

                Guido

                • 5. Re: MDB on queue from external context

                  :-)

                  I just re-read your original post with the
                  queue/whatever problem

                  See this
                  http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=

                  • 6. Re: MDB on queue from external context
                    sozonnik

                    Ok. I make it work. Example below.
                    But is another question:
                    I have firewall between this servers. What ports have to be opened for proper operation ? Is it enough to have JNDI and OIL ports ?

                    HelloMDB.java

                    import javax.ejb.*;
                    import javax.jms.*;

                    public class HelloMDB implements MessageDrivenBean, MessageListener
                    {
                    private MessageDrivenContext ctx = null;

                    public HelloMDB()
                    {
                    }

                    public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
                    {
                    this.ctx = ctx;
                    }

                    public void ejbCreate()
                    {
                    }

                    public void ejbRemove()
                    {
                    ctx=null;
                    }

                    public void onMessage(Message message)
                    {
                    System.err.println("Got message " + message.toString());
                    }
                    }


                    ejb-jar.xml


                    <?xml version="1.0" encoding="UTF-8"?>
                    <!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 Beans -->
                    <message-driven >
                    <![CDATA[]]>
                    <ejb-name>HelloMDB</ejb-name>
                    <ejb-class>HelloMDB</ejb-class>
                    <transaction-type>Container</transaction-type>
                    </message-driven>
                    </enterprise-beans>
                    </ejb-jar>


                    jboss.xml

                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">



                    <invoker-proxy-bindings>
                    <invoker-proxy-binding>
                    remote-message-driven-bean
                    <invoker-mbean>default</invoker-mbean>
                    <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
                    <proxy-factory-config>
                    RemoteJMSProvider
                    StdJMSPool
                    15
                    1
                    True

                    10

                    queue/DLQ
                    10
                    0


                    </proxy-factory-config>
                    </invoker-proxy-binding>
                    <invoker-proxy-binding>
                    iiop
                    <invoker-mbean>jboss:service=invoker,type=iiop</invoker-mbean>
                    <proxy-factory>org.jboss.proxy.ejb.IORFactory</proxy-factory>
                    <proxy-factory-config>
                    <web-class-loader>org.jboss.iiop.WebCL</web-class-loader>
                    per-servant
                    <register-ejbs-in-jnp-context>true</register-ejbs-in-jnp-context>
                    <jnp-context>iiop</jnp-context>
                    RemoteJMSProvider
                    StdJMSPool
                    15
                    1
                    True

                    10

                    queue/DLQ
                    10
                    0


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

                    <enterprise-beans>
                    <message-driven>
                    <ejb-name>HelloMDB</ejb-name>
                    <destination-jndi-name>queue/A</destination-jndi-name>
                    <invoker-bindings>

                    <invoker-proxy-binding-name>remote-message-driven-bean</invoker-proxy-binding-name>

                    </invoker-bindings>
                    </message-driven>
                    </enterprise-beans>


                    remoteJMS-service.xml





                    RemoteJMSProvider
                    jnp://xx.xx.xx.xx:1099
                    XAConnectionFactory
                    XAConnectionFactory
                    org.jboss.jms.jndi.JBossMQProvider




                    • 7. Re: MDB on queue from external context

                      Do you know how to use search?

                      OIL will not work through a firewall,
                      use UIL/UIL2.
                      You can see the port in jbossmq-service.xml

                      Regards,
                      Adrian

                      • 8. Re: MDB on queue from external context
                        sozonnik

                        &gt; OIL will not work through a firewall,
                        &gt; use UIL/UIL2.
                        &gt; You can see the port in jbossmq-service.xml

                        Yes, I've seen it.
                        But i will have one way access between servers. I mean that server with MDB can create connection to server with queue but not vice versa.
                        So, JNDI and UIL ports are enough ?

                        • 9. Re: MDB on queue from external context

                          Hi,

                          my jboss never seems to use the hostname of the remote jboss. I can shut down the remote jboss or give a wrong name at the attribute without any effect. No exception is thrown.
                          My MDB is not working with the remote topic of course. Any idea what's my mistake?

                          regards,

                          Guido

                          • 10. Re: MDB on queue from external context
                            sozonnik

                            First check through jmx-console that JMSProviderLoader MBean deployed and started.

                            • 11. Re: MDB on queue from external context

                              Hi,

                              it is started and bound. The state is 3. This does not change if I start or stop the remote jboss.
                              I tried to start and stop the bean after starting/stopping the remote jboss. It has no efect if the remote jboss is up or down.
                              If I try
                              <configuration-name>My Config</configuration-name>
                              and put the config (se above at this mailing thread) in there an execption is thrown, if the remote jboss is down. When using the <invoker-proxy-bindings>
                              settings (like the instruction sample above) this does not happen.
                              My MDB is not reacting to messages with both settings :-(


                              regards,

                              Guido

                              • 12. Re: MDB on queue from external context
                                sozonnik

                                I use Jboss 3.2.0 may be you have prior version ?
                                Try latest version.

                                • 13. Re: MDB on queue from external context
                                  priya71

                                  Is this still applicable to Jboss3.0.3.

                                  So if I add Remote JMS provider with provider url to jms-service.xml and add the remvote provider URL to jboss.xml I should be set

                                  • 14. Re: MDB on queue from external context
                                    npdavis

                                     

                                    "adrian@jboss.org" wrote:
                                    I've posted this a couple of times over the
                                    last couple weeks.

                                    You have to add your own provider to
                                    jms-service.xml then tell the MDB to use it.
                                    The key part is the ProviderUrl attribute
                                    to get the remote jndi.

                                    Regards,
                                    Adrian


                                    care to elaborate? This isn't in the pay docs, or if it is, I can't seem to find it, even after a week. Know where to find an example of all of this? Some of us find an example very helpful when doing something for the first time : )



                                    1 2 Previous Next