Call a Session Bean method every minute


EJB programming & troubleshooting: Call a Session Bean method every minute

  1. Call a Session Bean method every minute (2 messages)

    Hello, I have a Message Driven Bean that calls a Session Bean. The Session Bean Calls a Stored Procedure. I would like the Session Bean method (MySessionBean.logPerformance(performance)) to be called every one minute. Question: What is the implementation to call MySessionBean.logPerformance(performance)) every one minute? Below is the pseudo code: public class MyMDBBean implements javax.ejb.MessageDrivenBean, javax.jms.MessageListener { public void onMessage(javax.jms.Message msg, Object performance) { MySessionBean.logPerformance(performance); } Thanks for your support
  2. First of all onMessage method cannot take two parameters. It will accept only one parameter that is a Message object. If you want to call logPerformance() from inside onMessage method every one minute, I don't think that is possible. Because onMessage method is called by the container whenever there is a message in the queue.
  3. timer service[ Go to top ]

    Why dont u use ejb timer service. schedule it to cal your mdb which in turn wll call your session bean.