Vous êtes sur la page 1sur 7

Oracle SOA Suite 11g - Sample

SAMPLE NAME : adapters-db-107-Polling


COMPONENT : DB Adapter

SAMPLE NAME : adapters-db-107-Polling ................................................................... 1


COMPONENT : DB Adapter ...................................................................................... 1
OVERVIEW ....................................................................................................................... 1
PROVIDED FILES............................................................................................................. 2
STEP BY STEP INSTRUCTIONS .................................................................................... 2
RUNNING THE PREBUILT SAMPLE ........................................................................ 2
INSTALLING & CONFIGURING ............................................................................ 2
RUNNING THE SAMPLE......................................................................................... 2
VERIFYING EXECUTION ....................................................................................... 2
BUILDING THE SAMPLE............................................................................................ 2
LOGICAL DELETE................................................................................................... 3
DELETE ..................................................................................................................... 5
LAST READ ID ......................................................................................................... 5

OVERVIEW

This sample shows the three basic polling strategies or how to translate events
on the database into intiating instances of a BPEL or SOA process.

The simplest is selecting all possible rows inserted into a table, and afterwards
deleting them to guarantee they are only read once (DeletePollingStrategy).
Next simplest is updating a status column to insure they are only read once
(LogicalDeletePollingStrategy).

For the above reasons PollingStrategies are often called After Read Strategies.
However it is not just about what is done after the select. The third core strategy
assumes all new rows/events have an increasing key. So the select is for all
records with a key greater than the highest key previously processed
(LastReadId). This last highest key is stored in a helper table.

These three strategies: Delete, LogicalDelete, and LastReadId (or


SequencingPollingStrategy), are the three building block strategies and are
demonstrated in this sample. All three are active at once, though each has a
unique where clause so a row can only be picked up by one of these strategies
at a time.
Oracle SOA Suite 11g - Sample

PROVIDED FILES

This sample contains the SOA Project that you can deploy along with the sql
scripts.

STEP BY STEP INSTRUCTIONS

RUNNING THE PREBUILT SAMPLE

INSTALLING & CONFIGURING

• Go to sql and execute the SQL in setup.sql


• Open the jpr file in Jdeveloper, and deploy the sample to a running
WebLogic Server.

RUNNING THE SAMPLE

• Simply execute sqlplus @ start-delete, @ start-logicaldelete, or @ start-


lastreadid to kick off either of the three strategies.
• After running @ start-delete, the rows in MOVIES_IN will be deleted.
Insert them again by running @ sql/reset.

VERIFYING EXECUTION

• With adapter logging set to trace, you should see the polling SQL being
issued to the log files.
• After running the start script, go SELECT POLLING_STRATEGY FROM
MOVIES. It should correspond to the polling strategy that you started.

BUILDING THE SAMPLE

Please see the Database Adapter documentation, specifically the Database


Adapter Wizard Walkthrough. Please also see the previous MasterDetail tutorial,
as many screen shots from there are not duplicated here.
Oracle SOA Suite 11g - Sample

• Create a new SOAProject, with an empty composite in Jdeveloper. Don’t


forget to name it.

LOGICAL DELETE

• Create a polling DbAdapter process (“Poll for New or Changed Records in


a table”).
• Choose LogicalDelete (“Update a field in the [MOVIES_IN] Table”), and
enter the values as:

• Hit next to the end and finish. For these core samples we will not discuss
any advanced options. However on the where clause page add a query
criteria:
Oracle SOA Suite 11g - Sample

• This way two polling strategy processes active at the same time won’t
interfere with each other. The end sql will look like (by going back to the
“Polling Options” page:
Oracle SOA Suite 11g - Sample

• Now add a Mediator, a DbAdapter merge outbound, and an xslt, as per


the MasterDetail sample.

DELETE

• The alternate steps to modelling the delete are quite simple. Simply
choose “Delete the Row(s) that were Read” and hit next:

• Add a where POLLING_STRATEGY = ‘DELETE’, and the SQL should


look like:

• You can reuse the outbound merge reference, but you will need to create
another Mediator component and transform.

LAST READ ID
Oracle SOA Suite 11g - Sample

• To model LastReadId, create a polling service and choose “Update a Sequencing


Table”.
• Then fill out the Sequencing helper table information as:

• Add the WHERE POLLING_STRATEGY = ‘LastReadId’ and the polling sql


should look like:

• The final process should look like this:


Oracle SOA Suite 11g - Sample

Vous aimerez peut-être aussi