In this blog I will explain in details about how to built the interactions between Mediator and ASynchronous BPEL Process.(Request and Callback Pattern)
Please Note that both BPEL as well as Mediator are the complementary components and do similar tasks.
BPEL is process based and Mediator is routing based.
BPEL is usually for long running process where as Mediator is for short and fast messages.
As stated this blog is about design Interaction Pattern between Mediator and ASynchronous BPEL process .
Example -In this example we have WebService that will take Input for Sales Order and call Mediator process.
If Order Price is < 50 Mediator route the flow to Partner link Service to Insert the data into Sales Order Table.
If Order Price is > 50 Mediator route flow to BPEL Process , BPEL process just assign the Input Variable to output variables. We can also define Callback Reply in Mediator Process.In My example I define ASysnchorous reply as SERVICE to Insert the Sales Order Data in table.
Complete Flow . -
Below is complete flow of my Process. I have Web service to received Input , Mediator to Route the process.BPEL to just to assign the i/p to o/p and 1 database Adaptor to validate the data.
Define your Message Structure ( Structure for your Input data).In my case I have defined a simple Order Structure with few elements, as shown below.
Save it as OrderInfo.xsd
Step # 2
- Let user Enter Sales Order data Manually.
- Insert Data into Sales Order Table if Order less than 50.
- Call BPEL Process if Order More than 50 and then Insert into Sales Order table.
Create a Web Service by Dragging "Web Service" Service Adapters from Component Palette and the associate "Order Info" Schema " by populating the OrderInfo.xsd in URL field in Request. Tab
Define a Partner Link by Dragging "Database Adapter" from Component Palette , drop it in External References, name it "InsertOrder".
Configure this database adapter to Insert the data into so_info table.Please note that in my example structure of so_info database table and "OrderInfo.xsd" file is same.
Drag Mediator Service component in Component and link "WebService" and Database Adaptor. (Pls refer Complete flow diagram)Configure the Mediator component to Insert data accepted as Input in webService to "InsertOrder" partner link as shown below.
As part of requirement 3 , I need to validate the customer rating if Order amount is MORE than 50.For that I have designed a BPEL Process which will take "OrderInfo.xsd" as input and then cassign that to Output variable.While designing the BPEL Process make sure that you assign "OrderInfo" Message type to
- Input - Process Request Message
- Output - Process Response Message
Step A -Import "OrderInfo" Message structure in BPEL Process shown Below. -
Click the BPEL Process > Click the Schema and then > Import Schema
Step B -
Once you imported your Message Type .Assigin it to Input and Output variable of your Process.In my Example I want my Input and Output Variable should be of same structure , so I associate same message structure with input and output variable.
To fuilfill my requirement , I have bulit a filter in Mediator process and called a BPEL process to ASSIGN i/p to o/p if Order is More than 50.Also I want to pass the same "OrderInfo"Message Structure to BPEL Process.For that I have already assign "OrderInfo" Messaage type to
- Process Request Message
- Process Response Message , please verify that.If it is not assigned yet , assign that as shown below.
- (Refer muy blog http://eoracleapps.blogspot.com/2009/10/how-to-create-bpel-process-to-insert.html to learn more).
As shown above I have selected -Message Type > Process WSDL > Assign the OrderInfo Structure to Request and Response Message Type.
Below is the BPEL Process ,that just take the i/p variable and then assign same to o/p variable by means of ASSIGN activity.
Once BPEL Proces is ready configure Mediator to Call the BPEL Process if Order Total is Greate than 50 as shown below.
Mediator Structure . - Here I set the Routing Rules
In Mediator we can define all routing rules as shown below.
Post a Comment