Split Join :
This is one of an interesting feature in OSB , however if you know how FlowN works in Bpel this will appears to be same.
Use Case:
Orders -> Multiple Items
Services :
1. Get each Item Status (Instock/outStock)
2. Get Order Status.
Now split join splits the input request to multiple threads and executes parallely.
Like in this case for an Order with 10 items , 10 threads will get spawned.
Resources:
XSD : Order/Item Element
WSDL : for ItemStatus Service and Order Status service
Bpel : Implement the getItemStatus service for inividual item
OSB :
1. create a project for split join
2. Import XSD and both WSDl
While importing wsdl it may create xsd as well , update the source with imported xsd from xsd folder and then delete the
created one.
3. Create a Buss Service based on Item WSDL (get url from EM), this will be invoked as part of split join
http://localhost:8001/soa-infra/services/default/SplitJoinRrcs/getitemstatusbpel_client_ep?WSDL
4. Create split join based on getOrderStatus Service , select operation.
- It will create Receive and Reply activity and request and response variables as well
- initialize the response variable by adding an assign action , Put this Assign action right after Receive
<ord:Order xmlns:ord="http://pchanel/Orders">
</ord:Order>
- add a ForEach Flow Control to iterate each item in Order
parallel = yes
counter var = loop
start counter = 1
final counter = count($request.payload/Items)
- Add invoke service for the check Item status for each Item inside for each
Before invoke and inside scope
---------------------------------------------
- create input/output scope variable for the service invoke
- Add another var "Param" to pass the value to the Service
- Add assign action inside the for each , initialize input variable for service
<ord:Item xmlns:ord="http://pchanel/Orders">
</ord:Item>
- Add copy operation to copy items to Param
from exp : $request.payload/Items[$loop]
to exp : $Param.payload
- Add replace to replace the service input with Param
Replace "." in input.payload with Exp : $Param.payload
Replace entire node
---------------------------------------------
- After the service invoke add Insert
Exp : $output.payload
LOcation : as first chil of
Xpath : .
Variable : response.payload
5. Right click split join.flow -> OSB -> Generate BS
Thats it split join is done !!
This is how it will look like in eclipse:
No comments:
Post a Comment