"The basic idea behind dynamic routing is to separate the control logic, which determines the path taken by the process, from the execution of the process. Dynamic routing enables you to dynamically route messages at runtime from a mediator to multiple target services, based on the message content. You can use Domain Value Maps (DVMs) or Decision Components (Business Rules) to override static routes at runtime."
Dynamic Routing using DVM:
Use Case: There are two providers viz. Provider1 and Provider2 both of which are based on the same abstract WSDL. The Mediator has to invoke Provider1 or Provider2 based on the input. The logic for this mapping is:
If the input is Provider1 then invoke Provider1
If the input is Provider2, invoke Provider2
Create the composite where we will implement the Dynamic Routing via mediator. The composite contains a mediator(based on the Abstract WSDL we created earlier), a Service client and a Reference which points to the Provider1.
Open the mediator and click on Assign Values and map the input
Now, click on Override. This will allow you to define a DVM that will be used for the routing. Enter the Name and Location of the DVM and then Set the values as shown in the screenshot below
Here we basically do two things:
Set the Value Expression and Key Domain: This allows the request input to be used as a key in the DVM
Set the feature we want to override: For this case, we override only the EndpointURI. For values that are not to be overidden, set it to <<Not Override>>.
When we chose DVM for the routing, JDeveloper creates the DVM and auto-populates the rows. For our use case, we require only the Keys and the endpointURIs (which we have mentioned as the value to be overridden) .
Assign the sync reply part.
Deploy and Test
Input is provider1 and provider1 service invoked.
Input is provider2 and provider2 service invoked.
Dynamic Routing using DVM:
Use Case: There are two providers viz. Provider1 and Provider2 both of which are based on the same abstract WSDL. The Mediator has to invoke Provider1 or Provider2 based on the input. The logic for this mapping is:
If the input is Provider1 then invoke Provider1
If the input is Provider2, invoke Provider2
Create the composite where we will implement the Dynamic Routing via mediator. The composite contains a mediator(based on the Abstract WSDL we created earlier), a Service client and a Reference which points to the Provider1.
Open the mediator and click on Assign Values and map the input
Now, click on Override. This will allow you to define a DVM that will be used for the routing. Enter the Name and Location of the DVM and then Set the values as shown in the screenshot below
Here we basically do two things:
Set the Value Expression and Key Domain: This allows the request input to be used as a key in the DVM
Set the feature we want to override: For this case, we override only the EndpointURI. For values that are not to be overidden, set it to <<Not Override>>.
When we chose DVM for the routing, JDeveloper creates the DVM and auto-populates the rows. For our use case, we require only the Keys and the endpointURIs (which we have mentioned as the value to be overridden) .
Assign the sync reply part.
Deploy and Test
Input is provider1 and provider1 service invoked.
Input is provider2 and provider2 service invoked.