May 21, 2010 1 Comment
After reading a nice article about TimerManager functionality in Weblogic, i wanted to see how easy it would be to schedule my test composite application.
First deploy your composite and go to SOA > soa-infra > default > Test > WSDL.
Copy/paste the wsdl, this one we will use to generate the web proxy.
Back in JDeveloper create a new Application (or add it to an existing one), and create a new Web Project.
Select the jsp option, we will use this page later to trigger the scheduler.
Generating the Web Proxy
This will generate all the code we need to invoke the composite application (wsdl).
The class with the name ending with ‘_ptClient’ contains all the code needed to do the invoke from java. This we will reuse later on.
For a little test, change the code so it calls the correct method of your composite application and check the console to see if it triggers a new instance.
Now we know for sure the proxy code itself is working, so we can go on with the code to schedule the invoke.
The code of the TimerManager i borrowed from this excellent blog.
Create both ‘TimerServlet’ servlet and the ‘TimerListener’ class, edit web.xml, and add link to the servlet to the index.jsp which we generated in one of the earlier steps.
Now copy/paste the example code of the ‘_ptClient’ class to the ‘TimerListener’ class, and select the method you want to call (in my case the ‘process’ method).
Deploy and Run
Go to the url of the index.jsp to trigger the scheduler, for example http://localhost:8001/MyBPELTimer-MyTimerClient-context-root/index.jsp
inside timerExpired() Starting schedule bpel, Fri May 21 12:25:03 CEST 2010 Finishing schedule bpel, response is : setOutput exiting timerExpired() inside timerExpired() Starting schedule bpel, Fri May 21 12:25:13 CEST 2010 Finishing schedule bpel, response is : setOutput exiting timerExpired() inside timerExpired() Starting schedule bpel, Fri May 21 12:25:23 CEST 2010 Finishing schedule bpel, response is : setOutput exiting timerExpired()
JDeveloper Project – It includes the generated code/imports against my own composite application. Regenerate the code against your own wsdl, and revalidate the code.