Tuesday, May 11, 2010

Getting starting with Oracle BPM 11g - Adapters Simple example

In this simple scenario we will read in an order via the FileAdapter. This order will be processed and, if approved, saved to file (non-domestic orders) or written to the Orders DB(domestic orders).



Steps
Create 2 directories on your file system (in & out) e.g.



Create a new BPM Application/Project



Define the File Adapter (Read)

Create File Adapter (Read) in composite.xml
Point to the input directory you created.
Poll every 5 seconds for docs of type *.xml

Set type to InOrder as defined in myOrder.xsd at Appendix A.



Define the File Adapter (Write)

Create File Adapter (Write) in composite.xml
Point to the output directory you created.
Set type to OutOrder as defined in myOrder.xsd at Appendix A.



Define the Database Adapter

Use Orders table defined at Appendix B.



select all columns



Leverage the Adapter Services in BPM

Back in the BPM Project navigator –



Create a Project Data Object for the incoming order






Edit the Start activity to leverage the file adapter (read) service




Delete the UserTask. We will add it again later, now we just want to test the adapters.
Drop a Service onto the page.







Create a second service task









Add Exclusive Gateway



Set Condition for Domestic.





Deploy & Test

Ensure you have set up the required DB artifacts on WLS before testing.
- In WLS Console -
-- Define a Datasource e.g. jdbc/scott
-- Target to soa_server1
-- Define a new connection pool (Deployments --> DBAdapter --> New)
--- Configuration --> New -->Outbound connection Pools
---- enter name you used when defining the DB adapter in your project e.g. eis/DB/scott

---- Edit the new connection pool and set xaDataSourceName to jdbc/scott

Back to the Deployments list -
Select DB Adapter --> then press Update




Test using xml payloads at Appendix C.
Non-Domestic orders written to the \out directory



Appendix A XSD



Appendix B Database Table SQL

CREATE TABLE ORDERS
(
ORDER_NR VARCHAR2(20 BYTE) NOT NULL
, CUSTOMER VARCHAR2(50 BYTE) NOT NULL
, EMAILADDR VARCHAR2(50 BYTE) NOT NULL
, COUNTRY VARCHAR2(50 BYTE) NOT NULL
, PHONE VARCHAR2(50 BYTE) NOT NULL
, PRODUCT VARCHAR2(50 BYTE) NOT NULL
, QUANTITY NUMBER(10, 0) NOT NULL
, UNITPRICE NUMBER(10, 2)
, SUPPLIER VARCHAR2(50 BYTE)
, TOTALPRICE NUMBER(10, 2)
, ORDERSTATUS VARCHAR2(50 BYTE)
, COMMENTS VARCHAR2(256 BYTE)
, CONSTRAINT SYS_C005116 PRIMARY KEY
(
ORDER_NR
)
ENABLE
)
;

Appendix C - Test Payload

9 comments:

WaLeX said...

Thanks!! It was very useful to me!! In fact, that was my firts bpm process. Can you give me a recomendtion for a bpm book?? Of course, I'm a bpm dummy... =P

Niall Commiskey said...

Sure,

try out Bruce Silver's book -

Bpmn Method and Style: A Levels-Based Methodology for Bpm Process Modeling and Improvement Using Bpmn 2.0

WaLeX said...

Thnks

WaLeX said...

Thnks

Unknown said...

Dear Niall,
Thanks for the sample demo. It was useful. I have got stuck with DB Adapter and needed your help/pointer. Any help/pointer would be welcome.

As per my business scenario, Is there any update in the database (offline approval. not using worklist) then i should complete the running BPM process for approval.
1. To achieve this, I created a adapter to poll and it is working in polling. What is not working is picking the update in process and mark is closed/complete.
2. I tried using Catch Event with continuation mode (but it needs throw event to begin with).
3. I also tried 'Receive event', which also needs start event for continuation.
4. If i use Initiate mode for catch event then it initiate a new process and mark it close and does not do anything with original process (having this catch event). This catch event is still waiting.
5. If i use "receive" event with Initiate mode then jdeveloper is giving compilation time error saying that some service is not referenced in composite.
6. I have also tried other options of using "Sub-process" or another process and invoking it but nothing seems to work.

Any help/pointers? Thanks a lot.
Regards
Sachin G

Unknown said...

Dear Niall,
Thanks for the sample demo. It was useful. I have got stuck with DB Adapter and needed your help/pointer. Any help/pointer would be welcome.

As per my business scenario, Is there any update in the database (offline approval. not using worklist) then i should complete the running BPM process for approval.
1. To achieve this, I created a adapter to poll and it is working in polling. What is not working is picking the update in process and mark is closed/complete.
2. I tried using Catch Event with continuation mode (but it needs throw event to begin with).
3. I also tried 'Receive event', which also needs start event for continuation.
4. If i use Initiate mode for catch event then it initiate a new process and mark it close and does not do anything with original process (having this catch event). This catch event is still waiting.
5. If i use "receive" event with Initiate mode then jdeveloper is giving compilation time error saying that some service is not referenced in composite.
6. I have also tried other options of using "Sub-process" or another process and invoking it but nothing seems to work.

Any help/pointers? Thanks a lot.
Regards
Sachin G

Unknown said...

Great tutorial. Any chance that we could get the source code and appendix files for the sample program? Thanks.

Suresh said...

Hi Niall, can we get the appendix files in text format?

Anonymous said...

Gr8 tutorial !!