Polling for changes in a database has been a requirement for systems for a very long time. With Oracle BPEL, of course, this need exists and we will review one way you can go about this.
Note: This particular article is not meant to provide a detailed background for each step, nor does it go through showing how to test end-to-end, but feel free to ask questions in your comments and I will be happy to update any areas that you are confused about.
Create a BPEL process that would poll the database periodically for records with a specific flag.
Step-by-Step Walkthrough with Screenshots
Create an asynchronous BPEL project using JDeveloper BPEL Plugin
Click Finish and view the JDeveloper design view.
Create a Database Adapter, by dragging and dropping ‘Database Adapter’ from the ‘Component Palette’ and begin configuring using the wizard.
Click ‘Next’ and choose a name for the service that will be created and available for consumption by your BPEL process.
Click ‘Next’ and select the appropriate ‘Database’ Connection from the drop down (or create a new connection if needed).
Click ‘Next’ and select ‘Poll for New or Changed Records in a Table’
Click on ‘Import Tables’ and Select the table that you wish to poll.
Once your table is selected:
As you poll entries, you must decide on a way to read and mark entries. We have chosen to update a field, setting all values to “FALSE” since we do not want Oracle BPEL to automatically update a field as soon as it is read; instead, we want to update the value ourselves later in the process, once we are sure certain processing has been completed.
Note: Assuming that you will update the ‘Task_Completed’ Flag after processing the records, you might want to change the wsdl to modify polling parameters.
Modify the receive activity to get data from the new Database Adapter Service