Monday 19 June 2017

OSB 12c - Database Polling using DB adapter

Oracle introduced couple of new features in 12c version 

which is recently launched. For OSB, the major shift that
 we saw in 12c is that now we can use Jdeveloper to do the development which we use to do through OEPE (Eclipse). With that change, we can leverage the existing technology adapter in OSB as well which we use to have in SOA. In OSB 11g version, in case of Database interaction, we use to create DB adapter in Jdeveloper and later import all required files to OEPE and generate required services from that, but in this new version-12c as we development in Jdeveloper itself so we need not to follow same steps again, we can add the DB adapter directly in OSB project and do required operations.

In this post, we show you how to use DB adapter in OSB 
project. For that we have created a table in database, we poll the data from that table and write that information to one file.
First of all we need to create a new OSB project, so first 
create a new project and then in composite.xml file, right click on proxy service lane, choose “Insert Adapters” and select Database to add DB adapter.

Provide name to adapter and click on next. In next window, choose DB connection (In our case it is local as we read the data from local table) and click on browse button to select the outbound connection pool created earlier for DB adapter. This search feature is a new feature that is introduced in 12c, with this feature we can go to server and select the outbound connection pool; we can even create new connection pool with this option.
In next window, choose “Poll for new or changed records in table” operation type as we need to poll the new or updated records then select the table from where we need to poll the record and also select primary key column. Also choose the column based upon that we need to read the record and select read & unread column values.
Once you complete all above steps, then you see DB adapter

gets added to the composite but you see one issue in that 

adapter as we haven’t added the pipeline yet. To add 

pipeline, right click on middle pane choose Insert à Pipeline.

Provide pipeline name and in service type choose “Any SOAP” as we will get the data in soap format from DB adapter. Ensure that “Expose as a proxy service” checkbox is unchecked as we already have proxy service created using DB adapter, if you keep that checked then you will notice that it will add one more proxy in the same composite.
Now you can add wire DB adapter with pipeline. Then add file adapter to write the file and wire it to pipeline. Now go inside the pipeline and add route node after the start node in message flow. Add routing action inside route node, in routing select the write file adapter business service .

Add new record to source table and you notice that data

 successfully picked from that table and written to target file.

No comments:

Post a Comment