Wednesday, 17 January 2018

Setting Composite Instance Title in Mediator involving concept of "Echo"

Hi All,

In this post we try to use "CompositeInstanceTitle" function which sets the composite instance title and returns it.

In BPEL we must assign the return value to a variable.
In Mediator we must assign it to a property.

Also in this composite , we are using Echo in Mediator.

Echo option is used when we don’t have target service available ,we expose Mediator functioanlity as taraget service and Echo a respone to intial caller .

Suppose we are doing qurey from target service but that target service is down due to some reason , in this case to test our Mediator we use Echo, we will create sample query response message and pass that to calling service as a Echo.

Demonstration:

Steps:
1. Create new application ; new soa Project; an empty composite

2. Create XSD


3. Create WSDL


4. Drop Mediator component; based on wsdl; expose as soap service



5. Create static routing rule; use echo option


6. Click on Assign
Assign Value From Expression to Property


Edit expression; Choose from Mediator Extension Function

expression:
med:setCompositeInstanceTitle(concat('Mediator Instance ID is',med:getCompositeInstanceId()))


Add Property ( literally Type ; as we do not find this property in the list )

Property:
tracking.compositeInstanceTitle




7. Save all and deploy

Testing: 

Checking the flow trace







Thus we are now able to set Composite Instance title using the function in Mediator.

Also we have successfuly exposed Mediator as service using Echo.

Let's Keep Exploring SOA!

Cheers to the next..
Krithika :) 

Tuesday, 16 January 2018

Setting Composite Instance Title in BPEL

Hi All,

This post is about naming your Composite Instance so that it can be easily identified among a pile of instances.

"setCompositeInstanceTitle function sets the composite instance title and returns it.  In  BPEL you must assign the return value to a variable"

Use case: Suppose we are getting orders for different items and we would like to identify each order based upon some Unique OrderID. Then instead of going through the audit trail/flow to find out; we can try to add unique id along with composite instance id in Composite Instance Title.

Such that it is easy to identify which instance is processing which OrderID.

Demonstration:

I am taking my previous developed composite - Correlation to demonstrate setting of Composite Instance Title.

Steps:

1. Add Assign activity after Receive like below:


2. Add a global variable Title of type String


3. Edit Assign then Add function to newly added variable Title:




Choose from Advanced Function; Ora:setCompositeInstancetitle() ; then 
add concat (orderID+CompositeInstanceID)

Actual xpath:

ora:setCompositeInstanceTitle(concat('OrderID',bpws:getVariableData('inputVariable','part','/client:Order/client:OrderID'),' ',' ','CompositeInstanceID-', ora:getCompositeInstanceId()))

4. Save all and Deploy

Test: 

1. Testing with inputs: OrderID - 03


 2. Checking Composite name:


Thus, we can see our use case has been achieved, now instance name has OrderID and InstanceID.

Let's keep exploring SOA!

More to come
- Krithika :) 

Friday, 12 January 2018

Correlation Set Concept to Interrupt the Flow of BPEL

Hi All,

To identify the messages (requests, delayed responses) in asynchronous communication, we can use Correlation Sets.
It correlate the messages when interacting with the Asynchronous systems.

In BPEL for asynchronous communications is implemented with WS-Addressing internally to identify the partner to whom we need to send the callback using the unique id.
We can override the default implementation (WS-Addressing) , using Correlation Sets.

You can use correlation sets in invoke, receive, pick, and reply activities to indicate which correlation sets occur in the messages that are sent and received.

The values of each correlation set uniquely identify the process instance. This is true even if the process instance has already reached an end state, such as the finished state

Use Case:
In typical business systems like “Order Management”, we will place an order request and to deliver the ordered items it may take some time. Once the requested items are delivered then the order request will be closed. In mean while we can cancel the order request as well.
To cancel the order request, we will be providing the unique data provided while placing the order request.

Steps in creating Correlation Set:

1. New SOA Application--> New Project --> New Composite
2. Create an asynchronous BPEL , expose it as soap service
3. Edit the XSD according to the requirement


4. Edit the wsdl


 Composite will look like below:




5. Create Process Logic inside .bpel, add wait activity




6. Edit Recieve add correlation Set for Recieve message


Select Correlations ( Demonstrating by Creating a new Correlation Set )






 Here query Does not get generated and we are not having a declarative method to create , So Click "CTRL+Space" and drill down to OrderID







Make Initiate as YES while creating correlation Set for recieve activity


7. Add OnMessage branch , Add Terminate




8. Edit OnMessage , Edit existing correlation Set to add a property for Cancellation message






generate query ( ctrl+space --> drill down to cancellation OrderID )



Now that we have added OrderID from cancellation message, we are having 2 properties under the same Correlation Set.





9. Now as we have built our composite it will look like below:



10. Deploy, test for OrderRequest Operation






10. Test for OrderCancellation Operation ( here we try to cancel the same order placed )


 The running Process gets Terminated and the on message branch gets executed




Thus our use case is justified! 

Let's Keep exploring SOA!
- Krithika :)