1 Reply Latest reply on Oct 23, 2003 1:05 AM by Stephane Nicoll

    Message-Selector, JBOSS, External Provider

    rg Newbie

      Hello,

      I am trying to use a message-selector for an MDB, but looks like it is getting ignored. My MDB is hosted on JBOSS 3.2.1, I have an external JMS provider. Not able to figure out what could be the reason. Here is my ejb-jar.xml:

      <?xml version = "1.0" encoding = "ISO-8859-1" ?>

      <!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>
      <ejb-name>QueueTextMessageBean</ejb-name>
      <ejb-class>test.jms.listeners.QueueTextMessageBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-selector>MethodName = 'GetOrder'</message-selector>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>Durable</subscription-durability>
      </message-driven-destination>
      </message-driven>
      <message-driven>
      <ejb-name>GetCustomerMessageBean</ejb-name>
      <ejb-class>test.jms.listeners.GetCustomerMessageBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-selector>MethodName = 'GetCustomer'</message-selector>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>Durable</subscription-durability>
      </message-driven-destination>
      <resource-ref>
      <res-ref-name>jms/QueueFactory</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </message-driven>
      <message-driven>
      <ejb-name>CreateCustomerMessageBean</ejb-name>
      <ejb-class>test.jms.listeners.CreateCustomerMessageBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-selector>MethodName = 'CreateCustomer'</message-selector>
      <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
      <subscription-durability>Durable</subscription-durability>
      </message-driven-destination>
      <resource-ref>
      <res-ref-name>jms/QueueFactory</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </message-driven>
      </enterprise-beans>
      </ejb-jar>

      Here is the place in my code where I am setting the string property while sending the message:

      MapMessage message = createMapMessage();
      message.setInt("customerId", id);
      message.setStringProperty("MethodName", "GetCustomer");
      System.out.println("CustomerService:getCustomer(), sending message for processing");
      return (ICustomer) processSynchronousMessage(message);


      The first MDB in the ejb-jar.xml always receives the message. Could it be because I had to create a factory of external server session pool, since I was getting ClassCastException with the JBOSS server session pool.

      Appreciate any help.

      Thanks,
      RG.