5 Replies Latest reply on Jun 25, 2008 5:56 AM by Kevin Conner

    JMS Selector support in 4.3GA

    Mathieu Pasture Newbie

      Hello,

      I have a JBossESB application and running fine with JBossESB 4.2. The application uses the same queue for all the internal "aware"communications:

      <jms-provider name="default_internalbus" connection-factory="ConnectionFactory" jndi-context-factory="org.jnp.interfaces.NamingContextFactory" jndi-URL="localhost" jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
       <jms-bus busid="WebGateway_Aware">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/default_internalbus" selector="service='WebGateway'"/>
       </jms-bus>
       <jms-bus busid="processPipeService_Aware">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/default_internalbus" selector="service='processPipeService'"/>
       </jms-bus>
       <jms-bus busid="fault-to-service_Aware">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/default_internalbus" selector="service='fault-to-service'"/>
       </jms-bus>
       </jms-provider>
      



      This setup doesn't seem to work with 4.3, the message is always picked up by the WebGateway_Aware. It includes a


       <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
       <property name="destinations">
       <route-to service-category="proc" service-name="processPipeService" />
       </property>
       </action>
      


      that is ignored and therefore inducing a infinite loop.

      Thanks in advance for your advices.

      Mathieu

        • 1. Re: JMS Selector support in 4.3GA
          Kevin Conner Master

          We are not aware of any issues in this area, could you send me a test case?

          • 2. Re: JMS Selector support in 4.3GA
            Mathieu Pasture Newbie

            I prepared a test case showing the problem:



            It uses 5 files:
            - A test client: SendJMSMessage.java
            - A gateway queue : gw1-service.xml
            - A aware queue : internalbus-service.xml
            -A ESB archive with two files in it:
            - jboss-esb.xml
            - deployment.wml


            (I couldn't find a way to attached them, so I will copy past:)
            SendJMSMessage.java

            import java.util.Properties;
            
            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.InitialContext;
            
            
            public class SendJMSMessage
            {
             private static final String CONNECTION_FACTORY = "ConnectionFactory";
             private static final String DEFAULT_INITIAL_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
             private static final String DEFAULT_PROVIDER_URL = "localhost:1099";
             private static final String DEFAULT_SECURITY_PRINCIPAL = "admin";
             private static final String DEFAULT_SECURITY_CREDENTIALS = "password";
             private static final String INITIAL_CONTEXT_FACTORY_KEY = "INITIAL_CONTEXT_FACTORY";
             private static final String PROVIDER_URL_KEY = "PROVIDER_URL";
             private static final String SECURITY_PRINCIPAL_KEY = "SECURITY_PRINCIPAL";
             private static final String SECURITY_CREDENTIALS_KEY = "SECURITY_CREDENTIALS";
            
            
             public static void main(String[] args) {
             try {
             Properties environmentProperties = new Properties();
             environmentProperties.setProperty(INITIAL_CONTEXT_FACTORY_KEY, DEFAULT_INITIAL_CONTEXT_FACTORY);
             environmentProperties.setProperty(PROVIDER_URL_KEY, DEFAULT_PROVIDER_URL);
             environmentProperties.setProperty(SECURITY_PRINCIPAL_KEY, DEFAULT_SECURITY_PRINCIPAL);
             environmentProperties.setProperty(SECURITY_CREDENTIALS_KEY, DEFAULT_SECURITY_CREDENTIALS);
            
             SendJMSMessage sendJMSMessage = new SendJMSMessage();
             sendJMSMessage.sendMessage(environmentProperties, "azerty".getBytes());
            
             System.out.println("done");
             } catch (Exception e) {
             e.printStackTrace();
             }
             }
            
            
             protected void sendMessage(Properties environmentProperties, byte[] content) throws Exception {
             InitialContext iniCtx = new InitialContext(environmentProperties);
             Object tmp = iniCtx.lookup(CONNECTION_FACTORY);
             QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
             QueueConnection conn = qcf.createQueueConnection();
             Queue que = (Queue) iniCtx.lookup("queue/gw1");
             QueueSession session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
             conn.start();
            
             QueueSender send = session.createSender(que);
             ObjectMessage tm = session.createObjectMessage(content);
            
             send.send(tm);
             send.close();
             conn.stop();
             session.close();
             conn.close();
             }
            }
            


            gw1-service.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <server>
             <mbean code="org.jboss.jms.server.destination.QueueService"
             name="jboss.messaging.destination:service=Queue,name=gw1"
             xmbean-dd="xmdesc/Queue-xmbean.xml">
             <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
             <depends>jboss.messaging:service=PostOffice</depends>
             </mbean>
            </server>
            


            internalbus-service.xml


            <?xml version="1.0" encoding="UTF-8"?>
            <server>
             <mbean code="org.jboss.jms.server.destination.QueueService"
             name="jboss.messaging.destination:service=Queue,name=internalbus"
             xmbean-dd="xmdesc/Queue-xmbean.xml">
             <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
             <depends>jboss.messaging:service=PostOffice</depends>
             </mbean>
            </server>



            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" >
             <providers>
            
             <jms-provider name="gw1" connection-factory="ConnectionFactory" jndi-context-factory="org.jnp.interfaces.NamingContextFactory" jndi-URL="localhost" jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
             <jms-bus busid="gw1">
             <jms-message-filter dest-type="QUEUE" dest-name="queue/gw1"/>
             </jms-bus>
             </jms-provider>
            
             <jms-provider name="internalbus" connection-factory="ConnectionFactory" jndi-context-factory="org.jnp.interfaces.NamingContextFactory" jndi-URL="localhost" jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
             <jms-bus busid="gw1_Aware">
             <jms-message-filter dest-type="QUEUE" dest-name="queue/internalbus" selector="service='gw1Service'"/>
             </jms-bus>
             <jms-bus busid="processPipeService_Aware">
             <jms-message-filter dest-type="QUEUE" dest-name="queue/internalbus" selector="service='processPipeService'"/>
             </jms-bus>
             </jms-provider>
             </providers>
            
             <services>
            
             <service category="ba" name="gw1Service" description="gw1Service">
             <listeners>
             <jms-listener name="gw1" busidref="gw1" maxThreads="1" is-gateway="true" />
             <jms-listener name="gw1_Aware" busidref="gw1_Aware" maxThreads="1"/>
             </listeners>
             <actions>
             <action name="print" class="org.jboss.soa.esb.actions.SystemPrintln">
             <property name="printfull" value="true"/>
             </action>
             <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
             <property name="destinations">
             <route-to service-category="ba" service-name="processPipeService" />
             </property>
             </action>
             </actions>
             </service>
            
             <service category="ba" name="processPipeService" description="Process Pipe Service">
             <listeners>
             <jms-listener name="processPipeService_Aware" busidref="processPipeService_Aware" maxThreads="1"/>
             </listeners>
             <actions>
             <action name="print" class="org.jboss.soa.esb.actions.SystemPrintln">
             <property name="printfull" value="true"/>
             </action>
             </actions>
             </service>
             </services>
            </jbossesb>
            
            
            


            deployment.wml
            <jbossesb-deployment>
             <depends>jboss.messaging.destination:service=Queue,name=gw1</depends>
             <depends>jboss.messaging.destination:service=Queue,name=internalbus</depends>
            </jbossesb-deployment>




            • 3. Re: JMS Selector support in 4.3GA
              Mathieu Pasture Newbie

              I think I found the problem...

              if I add a invmScope="NONE" in

              <service category="ba" name="processPipeService" description="Process Pipe Service" invmScope="NONE">


              It does work. I guess that the InVm does not support selector...

              Mathieu

              • 4. Re: JMS Selector support in 4.3GA
                Kevin Conner Master

                The selector is only used to qualify the incoming JMS messages and would not be relevant to the InVM courier. The InVM courier should only be using the service category/name to deliver any messages.

                Could you please package up your test case and send it to my email address?

                • 5. Re: JMS Selector support in 4.3GA
                  Kevin Conner Master

                  Hiya Mathieu.

                  I tried running your app with InVM enabled and it worked as expected. Could you send me a log file from your test?

                  Thanks