Sunday, March 11, 2012

Bpel Dehydration and recovery


There are number of docs that explains dehydration and instance recovery. But is that really works in case server crashes or for some network failure.
Here are few test run based on some of closely related activities wait,checkpoint,dehydrate, sleep(inside java).

Wait : This causes bpel instance to get dehydrated and following activities will be executed in a different thread.
Invoke -> wait 1 -> invoke -> wait 2 -> assign -> finish
Here is what the thread display in audittrail inside java :
Thread before wait is : 130
Thread after wait 1   is : 238
Thread after wait  2 is  : 239

Checkpoint:This has similar behaviour as wait
Invoke -> chk 1 -> invoke -> chk 2 -> assign -> finish
Thread before checkpoint 1 is : 16
Thread after checkpoint 1 is : 232
Thread after checkpoint 2 is : 233

wait/checkpoint/dehydrate : All behaves same

Sleep: inside java embedd
Most people think this will cause dehydration , however this doesnt
Invoke -> sleep 1 -> invoke -> sleep 2 -> assign -> finish

Thread before sleep 1 is : 129
Thread after sleep  1 is : 129
Thread after sleep  2 is : 129

If you query the cube instance table for these activities you will find that except sleep all other updates the table with status "INITIATED" after dehydration. For sleep the row gets updated just once with status "COMPLETED"

That seems good , now lets see if the bpel actually do the recovery as per the documentation the saved instance will be recovered and re-executed from the last dehydration point.

Flow :
Invoke1 -> dehydrate ->server crash -> invoke 2
Here is what happened :
- Invoke 1 completed
- Instance gets dehydrated
- server crash
- DB store the state with : initiated
- Server started
- Instance gets recovered , state changed to running and completed from the dehydration point
- DB store the state with : completed

That looks good , there are couple of settings one must be careful with while expecting auto recovery.

these are listed here : Configuring Automatic Recovery for Oracle BPEL Process Manager
http://docs.oracle.com/cd/E17904_01/integration.1111/e10226/bp_config.htm

Tables to look out for in soa database :
CUBE_INSTANCE
CUBE_SCOPE
INVOKE_MESSAGE

Cheers !!

No comments:

Post a Comment