This post talks about Oracle BPM process communication with Asynchronous service.
When we talk about BPM process communication with other processes or services, Those processes or services can be synchronous or asynchronous.
Synchronous process/service can be invoked with Service Call flow object in Oracle BPM. It will be a straight forward approach,just by adding WebService adapter at external references and using service task to invoke the service.
In case of Asynchronous process /service,we must use send /receive task or throw/catch message events when designing flows in BPM.
For the sake of demonstration , I have created a simple SOA(BPEL) Asynchronous process. It can be find in this github location.
The SOA Asynchronous process accepts input and waits for 2 mins and then will send the response as callback operation.
Step1 : Create and IO xsd in order to perform data flow in the process. In this case, I have created simple xsd with input and output string elements.
Step2 : Create BPM Asynchronous process by providing input and output arguments derived from above given xsd.
Step3: Introspect AsyncSOABPEL process as a webservice adapter.
Step4: Perform Asynchronous service invocation with "Send Task" activity.
i) Drag and drop and Send Task activity in the location where you want to invoke Asynchronous process by providing necessary input arguments. And select the Asynchronous service request operation.
ii) Select correlation and create correlation key by adding "ID" variable as identifier. And make sure to select Initiate check box for Send Task's correlation.
Step5: Add "Receive Task" to get response back from Asynchronous service. The Receive task definition should be calling Callback Operation of Asynchronous Service.
i) Drag and Drop "Receive Task" to the desired location in your process flow. And then choose Callback Operation as implementation of the task.
ii) Select correlation link and use the same correlation key with ID element. So that the callback matches the request ID value and will retrieve the corresponding data from Asynchronous service.Make sure not to select Initiate checkbox for Receive Task's correlation.
Step 6: And then perform DataAssocation of Input and Output arguments and Data objects to flow the data in the process.
Step7: That't it , Deploy the process and test.
Test Results : Below highlighted Request and Callback operation response indicates the proper flow of Asynchronous request and response.
Code related to this example can be found in this github location.
When we talk about BPM process communication with other processes or services, Those processes or services can be synchronous or asynchronous.
Synchronous process/service can be invoked with Service Call flow object in Oracle BPM. It will be a straight forward approach,just by adding WebService adapter at external references and using service task to invoke the service.
In case of Asynchronous process /service,we must use send /receive task or throw/catch message events when designing flows in BPM.
Summary : Asynchronous process wont wait for response to be returned immediately. As soon as its been invoked ,the process will be running in the background.Its the responsibility of calling process to make sure to look for callback response from asynchronous process for the sent request. In order to identify the correlation between request and response , the design has to be made in such a way to use/add a unique identifier in the application design to be used as correlation.Correlations are used to identify the instance that receives the message in the peer process.
Defining a correlation for a process enables you to identify an instance in another process through the instance state and send a message to that specific instance.Check more about correlation in here.
In the below example we have added ID variable to correlate request and response.
Defining a correlation for a process enables you to identify an instance in another process through the instance state and send a message to that specific instance.Check more about correlation in here.
In the below example we have added ID variable to correlate request and response.
For the sake of demonstration , I have created a simple SOA(BPEL) Asynchronous process. It can be find in this github location.
The SOA Asynchronous process accepts input and waits for 2 mins and then will send the response as callback operation.
Step1 : Create and IO xsd in order to perform data flow in the process. In this case, I have created simple xsd with input and output string elements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <?xml version="1.0" encoding="windows-1252" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://org.prabhas.ande/Async/V1" targetNamespace="http://org.prabhas.ande/Async/V1" elementFormDefault="qualified"> <xsd:element name="RequestElement" type="Request"/> <xsd:element name="ResponseElement" type="Response"/> <xsd:complexType name="Request"> <xsd:sequence> <xsd:element name="Input" type="xsd:string"/> <xsd:element name="ID" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Response"> <xsd:sequence> <xsd:element name="Output" type="xsd:string"/> <xsd:element name="ID" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> |
Step2 : Create BPM Asynchronous process by providing input and output arguments derived from above given xsd.
Step3: Introspect AsyncSOABPEL process as a webservice adapter.
Step4: Perform Asynchronous service invocation with "Send Task" activity.
i) Drag and drop and Send Task activity in the location where you want to invoke Asynchronous process by providing necessary input arguments. And select the Asynchronous service request operation.
ii) Select correlation and create correlation key by adding "ID" variable as identifier. And make sure to select Initiate check box for Send Task's correlation.
Step5: Add "Receive Task" to get response back from Asynchronous service. The Receive task definition should be calling Callback Operation of Asynchronous Service.
i) Drag and Drop "Receive Task" to the desired location in your process flow. And then choose Callback Operation as implementation of the task.
ii) Select correlation link and use the same correlation key with ID element. So that the callback matches the request ID value and will retrieve the corresponding data from Asynchronous service.Make sure not to select Initiate checkbox for Receive Task's correlation.
Step 6: And then perform DataAssocation of Input and Output arguments and Data objects to flow the data in the process.
Step7: That't it , Deploy the process and test.
Test Results : Below highlighted Request and Callback operation response indicates the proper flow of Asynchronous request and response.
Code related to this example can be found in this github location.
Comments
Post a Comment