Long Running Process
Hi,
We are using OC4J , as j2ee server .We have a webbase system .
As per the client request , I need to start a long running report generation process which may take 4-5 hours and when it finished , i need to send emails to client process is finished and file is ready for down load from the link specified.
Can anybody suggest me what are the best options available.
I thinking of creating a JMS queue and attaching a client and start the creation process from the client , I bit sceptic about MDB as its long running process .I am not sure about where this JMS client will be running can it be a separate process out side OC4J or can I start a process (class) along with OC4J.
Please let me know your valuable suggestions.
Thanks,
s
[784 byte] By [
smilejavaa] at [2007-10-2 20:53:04]

MDBs are designed to be long running processes. The best part is, the JMS provider will persist messages until MDBs are available - so you could take down your MDBs and bring them back up again without loosing messages.
So I'd recommend using a JMS queue to send requests for report generations. Then when a report process completes the report, it should send a reply message indiciating its completed. Then the email process can consume these messages and send out emails.
While at first the use of JMS might appear to add extra complication - the great thing is it loosely couples your architecture - allowing you to take down & bring back online your MDBs handling the report generation or the emailing. As your system gets more complex, this loose coupling gets more valuable.
James
http://logicblaze.com/
Open Source SOA
It is possible, but creating files from a J2EE application is often frowned upon, because the filesystem is not transactional and can cause problems with failover or clustering - .e.g. if you create the file on Server A, but Server B receives the HTTP request to download the file. These are good reasons to store the report on a queue or in a database (depending on whether you want the report to persist after it has been downloaded)
For the same reason you need to be a bit careful about sending emails from MDBs as if a repeatable error occurs and you don't manage your exceptions property you could send some poor *** 1,000s emails to tell him his report is ready (I worked on a project once where one of the customer's in house development teams did this, but with SMS).