Christian Nicoll wrote:Hello
let's image that an cloud provider wants to send each day the price of the last 24 hours to their customers. The whole business logic for calculating this value and sending it to the customer is out of scope. Let's concentrate on the possibilities how such 24h timer service can be implemented through an EJB. From my understanding this is either possible through a message driven bean (MDB) or a stateless session bean (SLSB). The SLSB is for me the better choice because no messaging system is involved. On the other hand I read that an MDB will never be called directly from a client, which is also good for this requirement, and for an SLSB this is not true. Still, I would go with the SLSB.
What is your choice?
Regards,
Christian
Hi, Christian,
It sounds like a business process to me. Quartz is a great choice for running periodic business processes and to sending the results out to users.
I would:
a) Use a Quartz-based job to calculate the price and to persist it somewhere.
b) Use a Quartz-based job to retrieve the results and to post them to an MQ broker.
c) Use a Quartz-based job to send the results via your selected method to users by retrieving the messages from the MQ broker and sending them on their way while persisting the results of the send for the application's records.
Something like that should have comprehensive error-checking in order to account for any error conditions.
You are probably way done with this at this point, but maybe it is still helpful.
With warm regards,
Anton.
Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]