I'll try to be brief. I'm building a J2EE-based application on Weblogic 6.1 which accesses an Oracle 8i database in the backend. There is a requirement to check a certain condition in the database every night. If the condition is true, an email notification is sent to an individual, and, the database is updated. The condition is checked many times per execution of the nightly process, so many emails can be sent. I have 2 options: 1) Create a Java stored procedure in Oracle and set the procedure to run automatically at night. 2) Create a UNIX chron job that runs automatically. Both options have similar downsides. First, since neither method can access JAR located inside Weblogic, I would have to duplicate classes and place them in special locations in order for the java process, either running inside Oracle as a stored proc, or running on UNIX, to have access to specialized classes and common classes that are used throughout the applcication. This presents a problem because if the codebase changes in the application, then the codebase located ini other special locations for the nightly process might also be affected. What do you guys think? SAF [ February 19, 2002: Message edited by: SAFROLE YUTANI ]
Hi, 1. Write a JMS client program that can send a JMS message to a topic/queue. 2. Create a Message Driven Bean or a Weblogic Startup class that listens on to that topic/queue. 3. The Listener then can use the runtimes deployed in the WLS instance. Hope this helps.
Venkatraman Balasubramanian<br />SCJP2, SCWCD, SCEA Part I<br />BEA System Certified jCert Enterprise Developer (WLS 6.0).<br />MCSD, MCAD, OCA (Oracle 9i), OCP (JDeveloper R3)
Joined: Jul 06, 2001
That sounds like a great idea! I can create a small JMS client inside the Java stored procedure which can send messages to a message-driven bean listening for messages while running on WLS. Using this technique, I wont have to worry about placing any special classes on the database server, aside from "jms-1_0_2b.zip", which is not an archive that I have to worry about anyway since I wont be changing it. Thanks again, Venkatraman. This technique allows independence between the Java stored procedure and the codebase on WLS, which is exatly what I needed in order to prevent synchronization issues. SAF
You can also handle the scheduling problem by creating a servlet with dummy doGet/doPost whose init() method starts a thread that waits for the indicated time. Of course, the servlet has to be set to start on server startup rather than on the first request, since there isn't expected to be a first request. I've done something similar with a WebLogic startup class, but this is more portable and more directly tied to the rest of the webapp. WebLogic also has some timer support classes if they haven't been superseded by enhancements to the JDK.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jul 06, 2001
That's an interesting approach, Tim. And you're right, the servlet would be more tightly coupled with the rest of the app server since the servlet obviously exists in the same environment as opposed to a stored procedure. The only downside with using a thread is that you can only tell the thread to sleep for a specific amount of time. I dont think you can instruct a thread to perform work at a specific hour in the day, like 2AM. I would prefer to go with the later. thanks again, SAF
subject: Advice needed for design problem involving chronological jobs...