0 Replies Latest reply on Jan 31, 2006 12:53 PM by henry fan

    why Message Driven Bean is not called

    henry fan Newbie

      I am new to use ejb3.0' message bean in jboss. I am creating a pojo client as producer and write a ejb MDB to receive the messages, but it looks like producer working fine, there are not any exception come out, but the OnMessage method in my MBD .
      is never called, I am not sure if i missed something?


      here is producer codes:

      try {
      Context ctx = new InitialContext();
      Object object = ctx.lookup("ConnectionFactory");
      QueueConnectionFactory factory = (QueueConnectionFactory)object;
      Queue que = (Queue) ctx.lookup("queue/myQueue");
      QueueConnection connect = factory.createQueueConnection();
      QueueSession session= connect.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
      QueueSender sender = session.createSender(que);
      MapMessage message = session.createMapMessage();
      message.setString("cCode",clientCode);
      sender.send(message);
      connect.close();
      }
      catch (Exception e) {
      e.printStackTrace ();
      }

      here is MDB codes:

      @MessageDriven(activateConfig ={
      @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
      @ActivationConfigProperty(propertyName="destination", propertyValue="queue/myQueue"),
      @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "AUTO_ACKNOWLEDGE"),
      @ActivationConfigProperty(propertyName = "durability", propertyValue = "Durable")
      })
      public class TestMDB implements MessageListener {
      public void onMessage(Message message) {
      System.out.println("------Received message------");
      }
      }