3 Replies Latest reply on May 30, 2004 11:38 AM by Ron Jawanda

    Transactional MessageBean not responding to client submissio

    Ron Jawanda Novice

      I have a message bean that reponds to a client submitting a queue
      when I have

      QueueSession session = qc.createQueueSession (false,Session.AUTO_ACKNOWLEDGE);
      QueueSender sender = session.createSender(queue) ;
      TextMessage tm = session.createTextMessage("Hello World");
      qc.start() ;
      sender.send(queue,tm) ;



      Jboss reads the queue and reports on the console the output.
      ie: My message bean gets the attached queue text message.

      When I change it to false on the createQueueSession
      QueueSession session = qc.createQueueSession(true,0);
      QueueSender sender = session.createSender(queue) ;
      TextMessage tm = session.createTextMessage("Hello World");
      qc.start() ;
      sender.send(queue,tm) ;


      And then modify my ejb-jar.xml (see below) to support transactions.
      I don't get any response. ie: the message bean never sees the input.

      Anyone have an idea?
      Thanks a bunch.

      Ron

      <ejb-jar>
      <display-name>BranchConsolidator</display-name>
      <enterprise-beans>
      <message-driven>
      <display-name>HeadOfficeConsolidatorMessageBean</display-name>
      <ejb-name>HeadOfficeConsolidatorMessageBean</ejb-name>
      <ejb-class>ca.husky.imanmq.HeadOfficeConsolidatorMessageBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <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>
      <assembly-descriptor>

      <container-transaction>
      <method-permission>

      <ejb-name>HeadOfficeConsolidatorMessageBean</ejb-name>
      <method-name>*</method-name>

      </method-permission>
      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </enterprise-beans>

      </ejb-jar>

      My EJB onMessage is this
      public void onMessage(Message message) {
      System.out.println("Bean got message" + message.toString() );
      TextMessage msg = null;
      try {
      if (message instanceof TextMessage) {
      msg = (TextMessage) message;
      System.out.println("MESSAGE BEAN: Message " + "received: " + msg.getText());
      System.out.println("message.getJMSMessageID()= " + message.getJMSMessageID()) ;


      } else {
      System.out.println("Message of wrong type: " + message.getClass().getName());
      }
      // msg.notify() ;
      } catch (JMSException e) {
      System.err.println("MessageBean.onMessage: " + "JMSException: " + e.toString());
      mdc.setRollbackOnly();

      } catch (Throwable te) {
      System.err.println("MessageBean.onMessage: " + "Exception: " + te.toString());
      }