I have taken care that the message to MDB itself should be delivered once
and the message is getting consumed.
I am putting my code of ejbCreate()
Here counter is a static variable in some other class
/**
* This method is required by the EJB Specification.
*/
public void ejbCreate() {
log.debug("ejbCreate() of RcuTimerMDB - ejbCreate called");
if (RcuAfmDao.COUNTER == 0) {
this.subject = "RCUTimerToRunAt2PM";
postMessage();
RcuAfmDao.COUNTER++;
}
}
private void postMessage() {
// post a dummy message to the same queue bean
JMSQueueDispatcherInterface dispatcher = (JMSQueueDispatcher) ApplicationContextManager.getApplicationContext()
.getBean("jMSQueueDispatcher");
log.debug("inside postMessage" + dispatcher.toString());
dispatcher.dispatchToQueue(JMSQueueCommon.RCU_TIMER_QUEUE, new
String(this.subject));
log.debug("posted Message to: " + JMSQueueCommon.RCU_TIMER_QUEUE + "SUBJECT: " + this.subject);
}