In this exercise we are going to showcase a simple way of how can we do dynamic routing from your OSB pipeline flow to other proxy services.
We will mock the response from those proxy services just to showcase that how the control comes into a particular proxy based on dynamic routing.
First let's create the main proxy service and the corresponding pipeline..
You main proxy and Pipeline is ready. Now we will move further...
Creating Proxy 1 for creating out routing option1:-
-------------------------------------------------------------
Now, we have mocked the above pipeline-proxy. If any service calls the above proxy service, it will return the mocked response as above...
Now, We will finish up the main pipeline. Double click the pipeline to open it..
Now, we are done with implementing a simple dynamic routing..
We will mock the response from those proxy services just to showcase that how the control comes into a particular proxy based on dynamic routing.
First let's create the main proxy service and the corresponding pipeline..
NOTE: This is the XSD (Schema file) which we will use for our request and response messages.
Selecting 'Generate Pipeline' option will make to get with a Pipeline as well along with the Proxy Service.
Selecting Element for Request Message
Selecting Element for Response Message
You main proxy and Pipeline is ready. Now we will move further...
Creating Proxy 1 for creating out routing option1:-
-------------------------------------------------------------
Pipeline and ProxyService1 is ready, now we will put some business logic to pipeline. Double click the pipeline1 to open it..
We will mock the response as below:-
Now, we have mocked the above pipeline-proxy. If any service calls the above proxy service, it will return the mocked response as above...
Now, we will move to proxy service 2 for our second routing option:-
We have mocked this proxy service as well as we did above...
Now, We will finish up the main pipeline. Double click the pipeline to open it..
Add the pipeline to it as below...
Now, we will add as 'assign' to make our customized routing-map as below:-
Now, we will have an 'assign' to keep the 'department' name as input extracted from main proxy..
Now, we will apply dynamic routing as below...
'isProxy' will be true only and only if we are routing to some or the other proxy service only.
In case you want to route to business service(s), 'isProxy' will be false..
Now, we are done with implementing a simple dynamic routing..