0 Replies Latest reply on Mar 10, 2010 4:47 AM by Sridevi KA

    Problem in message flow in a bridge with two nodes of Jboss

    Sridevi KA Newbie

      Hi ...

       

        I am trying to bridge two nodes of JBOSS deployed on same machine.

       

      Target Node :

       

      test-bridge-service.xml

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!--
           Example deployment descriptor for a message bridge

           $Id: messaging-secure-socket-service.xml 2737 2007-05-29 17:56:49Z timfox $
      -->

      <server>


         <mbean code="org.jboss.jms.server.bridge.BridgeService"
                name="jboss.messaging:service=Bridge,name=TestBridge"
                xmbean-dd="xmdesc/Bridge-xmbean.xml">
               
            <!-- The JMS provider loader that is used to lookup the source destination -->  
            <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=MyRemoteJMSProvider,server=remotehost</depends>    
           
            <!-- The JMS provider loader that is used to lookup the target destination -->
            <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>   
           
            <!-- The JNDI lookup for the source destination -->
            <attribute name="SourceDestinationLookup">/queue/quickstart_helloworld_Request_esb</attribute>
           
            <!-- The JNDI lookup for the target destination -->
            <attribute name="TargetDestinationLookup">/queue/quickstart_helloworld_Request_esb</attribute>
           
            <!-- The username to use for the source connection
            <attribute name="SourceUsername">bob</attribute>
            -->
           
            <!-- The password to use for the source connection
            <attribute name="SourcePassword">cheesecake</attribute>
            -->
           
            <!-- The username to use for the target connection
            <attribute name="TargetUsername">mary</attribute>
            -->
           
            <!-- The password to use for the target connection
            <attribute name="TargetPassword">hotdog</attribute>
            -->
           
            <!-- Optional: The Quality Of Service mode to use, one of:
                 QOS_AT_MOST_ONCE = 0;
                 QOS_DUPLICATES_OK = 1;
                 QOS_ONCE_AND_ONLY_ONCE = 2; -->
            <attribute name="QualityOfServiceMode">0</attribute>
           
            <!-- JMS selector to use for consuming messages from the source
            <attribute name="Selector">specify jms selector here</attribute>
            -->
           
            <!-- The maximum number of messages to consume from the source before sending to the target -->
            <attribute name="MaxBatchSize">5</attribute>    
           
            <!-- The maximum time to wait (in ms) before sending a batch to the target even if MaxBatchSize is not exceeded.
                 -1 means wait forever -->  
            <attribute name="MaxBatchTime">-1</attribute>
           
            <!-- If consuming from a durable subscription this is the subscription name
            <attribute name="SubName">mysub</attribute>
            -->
           
            <!-- If consuming from a durable subscription this is the client ID to use
            <attribute name="ClientID">myClientID</attribute>
            -->
           
            <!-- The number of ms to wait between connection retrues in the event connections to source or target fail -->
            <attribute name="FailureRetryInterval">5000</attribute>     
           
            <!-- The maximum number of connection retries to make in case of failure, before giving up
                 -1 means try forever-->
            <attribute name="MaxRetries">-1</attribute>

            <!-- If true then the message id of the message before bridging will be added as a header to the message so it is available
                 to the receiver. Can then be sent as correlation id to correlate in a distributed request-response -->
            <attribute name="AddMessageIDInHeader">false</attribute>
           
          </mbean>

      </server>

      jms-ds.xml

       

      <!-- Remote JMS Provider -->
      <mbean
      code="org.jboss.jms.jndi.JMSProviderLoader"
      name="jboss.messaging:service=JMSProviderLoader,name=MyRemoteJMSProvider,server=remotehost">
      <attribute name="ProviderName">RemoteXAConnectionFactory</attribute>
      <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

      <!-- The combined connection factory -->
      <attribute name="FactoryRef">XAConnectionFactory</attribute>
      <!-- The queue connection factory -->
      <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
      <!-- The topic factory -->
      <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
      <attribute name="Properties">
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost:1199
      </attribute>
      </mbean>

      i have deployed helloworld example of ESB.The ESB is listening to queue.

       

      jboss-esb.xml

       

      <?xml version = "1.0" encoding = "UTF-8"?>

      <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">

       

      <providers>

      <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">

      <jms-bus busid="quickstartGwChannel">

      <jms-message-filter

      dest-type="QUEUE"

      dest-name="queue/quickstart_helloworld_Request_esb"

      />

      </jms-bus>

      <jms-bus busid="quickstartEsbChannel">

      <jms-message-filter

      dest-type="QUEUE"

      dest-name="queue/quickstart_helloworld_Request_esb"

      />

      </jms-bus>

       

      </jms-provider>

      </providers>

       

      <services>

      <service

      category="FirstServiceESB"

      name="SimpleListener"

      description="Hello World">

      <listeners>

      <jms-listener name="JMS-Gateway"

      busidref="quickstartGwChannel"

      maxThreads="1"

      is-gateway="true"

      />

      <jms-listener name="helloWorld"

      busidref="quickstartEsbChannel"

      maxThreads="1"

      />

      </listeners>

      <actions mep="OneWay">

      <action name="action1"

      class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction"

      process="displayMessage"

      />

      <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">

      <property name="printfull" value="true"/>

      </action>

      <!-- The next action is for Continuous Integration testing -->

      <action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>

      </actions>

      </service>

      </services>

       

      </jbossesb>

       

      I send messages to the source node but the ESB which is listening is not receiving the messages.

       

      Client code for sending message

      /*
      * JBoss, Home of Professional Open Source
      * Copyright 2006, JBoss Inc., and others contributors as indicated
      * by the @authors tag. All rights reserved.
      * See the copyright.txt in the distribution for a
      * full listing of individual contributors.
      * This copyrighted material is made available to anyone wishing to use,
      * modify, copy, or redistribute it subject to the terms and conditions
      * of the GNU Lesser General Public License, v. 2.1.
      * This program is distributed in the hope that it will be useful, but WITHOUT A
      * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
      * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
      * You should have received a copy of the GNU Lesser General Public License,
      * v.2.1 along with this distribution; if not, write to the Free Software
      * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
      * MA  02110-1301, USA.
      *
      * (C) 2005-2006,
      * @author JBoss Inc.
      */
      package org.jboss.soa.esb.samples.quickstart.helloworld.test;

      import java.util.Properties;

      import javax.jms.JMSException;
      import javax.jms.ObjectMessage;
      import javax.jms.Queue;
      import javax.jms.QueueConnection;
      import javax.jms.QueueConnectionFactory;
      import javax.jms.QueueSender;
      import javax.jms.QueueSession;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;

      public class SendJMSMessage {
          QueueConnection conn;
          QueueSession session;
          Queue que;
         
         
          public void setupConnection() throws JMSException, NamingException
          {
              Properties properties1 = new Properties();
        properties1.put(Context.INITIAL_CONTEXT_FACTORY,
          "org.jnp.interfaces.NamingContextFactory");
        properties1.put(Context.URL_PKG_PREFIXES,
          "org.jboss.naming:org.jnp.interfaces");
        properties1.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1199");
        InitialContext iniCtx = new InitialContext(properties1);

           Object tmp = iniCtx.lookup("ConnectionFactory");
           QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
           conn = qcf.createQueueConnection();
           que = (Queue) iniCtx.lookup("queue/quickstart_helloworld_Request_esb");
           session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
           conn.start();
           System.out.println("Connection Started");
          }
         
          public void stop() throws JMSException
          {
              conn.stop();
              session.close();
              conn.close();
          }
         
          public void sendAMessage(String msg) throws JMSException {
          
              QueueSender send = session.createSender(que);       
              ObjectMessage tm = session.createObjectMessage(msg);
             
              send.send(tm);       
              send.close();
          }
            
         
          public static void main(String args[]) throws Exception
          {             
           SendJMSMessage sm = new SendJMSMessage();
           sm.setupConnection();
           sm.sendAMessage(args[0]);
           sm.stop();
          
          }
         
      }

       

      Please help on this.I dont know whether this is problem with ESB or message bridging.