1
votes

My requirement is I will expose the ESB integration implementation as a REST API.

1) In the implementation part whenever they will call This ESB API it has to route based on content in the post request sent to ESB(this can be achieved by content based routing pattern ).

2) But on the Endpoint side Which is to be called by the ESB while routing based on content may vary means, if today there is 2 end point to call tomorrow it may rise to 5 like that how to apply changes are is there any solution. So, how to achieve this dynamic integration.

1
in each backend call, you call all the EP or just one of them?Jorge Infante Osorio
But once deployed with fixed endpoints and if tomorrow there is an addition of one more endpoint how to route based on message, as in switch case of content based routing the expression is already fixed for those already defined Endpoint to add one more I have to change the already deployed ESB file.user9596637
I think the best way is to maintain a mapping of endpoint and the content parameter in a separate endpoint as it is outside of the control of ESB. Whenever an endpoint is added, this mapping should be updated. In the ESB side, for each request, it retrieves this mapping and route based on the mapping. (The new routing should be dynamically created.)menaka_

1 Answers

0
votes

I have 4 ways to achieve this integration pattern.

1) Deploy files in the registry which has the endpoint in it and having the file name which is same as the content name(regex) sent in the payload for routing. Then by storing that name in property mediator and use concat function to read that file in another property mediator, and by pattern matching read the endpoint. Thus you can use that endpoint and achieve the dynamic content based routing.

2) Have separate sequence each one to call one endpoint and have the same name as the content name. The main sequence will call the sequence based on the content.

3)Store the content on which to be routed and endpoint in the RDBMS database then use DB lookup mediator to retrieve the endpoint based on this you can route.

4) I think this is best and suitable for integration scenario where tomorrow the endpoint may change( that is when the number of the endpoint is not fixed ) and each endpoint wants a different transformation of the payload(I mean XML to json or JSON to XML etc..).

First, use one API and store the content in property mediator and use that mediator to call another API which has the implementation to call the endpoint.

For example, if the content based on which routing has to happen has the payload like this

{ "content":"c1" }

Store the content in property mediator using name uri.var.address. Then create another API's which will have the implementation to call endpoint(For each endpoint create separate API's) and URI-Template of the API's should have content stored in the property mediator(same as payload request). While using send mediator to call these ENDPOINT implemented API's use http request having url of the API with /{uri.var.address} because to match the URI-template details.