1

I have requirement where i want to integrate different Service providers REST APIs and switch to one of them based on request parameter. Example if request parameter has type ="A" than I will be redirecting request to Service Provider A , get data ,map it and then respond back to client. If type = "B" I will be redirecting request to Service Provider B and same applies for C...Z Types

Here One solution i can think of is having factory Pattern and get Client based on the type. and for Request/Response mapping i have to maintain Mapper classes for each Service Provider.

Is there any framework in java where i can make this configuration based, like all Request/Response mapping will be maintained in either xml/json file and the framework will take care of everything else.

And this can be plug and play kind where in future if new Service Provider is integrated than no code changes are required and the new Service Provider can be integrated by adding Request/Response mapping file directly.

Diagram

nikhil
  • 877
  • 3
  • 11
  • 36
  • 1
    I'd suggest you look into EIP. Something like Apache Camel has [content-based routing](https://camel.apache.org/components/3.4.x/eips/content-based-router-eip.html), which you can base on data only if you map both data and calls in your routes. – ernest_k Jul 28 '21 at 05:38

0 Answers0