

More information on Content Based Router(CBR) can be found here.
The CBR can be implemented either using a Mediator or a BPEL process. Mediator approach would be recommended as it is a light weight component and uses the SOAComposite's runtime unlike BPEL which starts its own runtime. So unless the functionality can't be achieved using a mediator do not go for a BPEL process.
This post explains the implementation of CBR using a Mediator. Will put a separate post on the BPEL implementation later.
Use-case prototyped:
Based on the location where the employee joins the corresponding OnboardingProcess has to be initiated. Say if the employee's location is US then USOnboarding BPEL process has to be initated. If location is US then USOnboardingProcess.
Implementation:
The Employee.xsd schema file is as follows:


Create two BPEL process, one for the US Onboarding and the other for the UK. Link the BPEL processes to the mediator.

Double click and open the CBRouter mediator component.

Set the Filter condition for each of the routing rules by clicking the funnel icon.

In the expression builder, expand the payload node in the variables section and double click on 'Location'. This is populate the corresponding expression. Then complete the expression by adding ='US' or something appropriate. Then press OK. Repeat the same for the other routing. Now when the mediator is invoked, it will first inspect the payload and evaluate the filter condition. If satisfied, it will route else it will skip.
When you run this Composite with the Location field of the Payload set to US, then the first routing rule in the mediator will be executed resulting in the invocation of the USOnboarding BPEL Process.
You can download the sample application from here.
Please post your queries in the comments section.
No comments:
Post a Comment