Author: Hemanth Singh
Here we are trying to maximize the use of property files.
Property file is well known for externalizing the value which may change in the future. It gives the feature to update/add the configuration details without disturbing the code.
Requirement: There is one to many point integration. Source API is calling other endpoints depending on source API’s input.
Design: Source API is using uri parameter as key to decide target API. Depending on uri parameter, it is creating property keys which are being used for reading all configuration details for invoking target endpoints.
- We are maintaining configuration details in property file. It is highly scalable. For adding other target endpoints, we only have to add its configurations details in property file.
- We are fetching configuration details of target endpoints with respect to input uriparam of source api.
Preparing property keys:
Reading its value from property file:
- Then using these configurations for invoking the target endpoint.
I have configured some GET API’s (like facebook.com, twitter.com/login). We can verify source API using any web browser.
- Simple design, more readable code
- Easy maintenance
- Scalable (just by adding another set of configuration details for each new target API)
- Target communication should be of same protocol else we can’t use the same pallet to connect (For e.g. here we are using “http requester”)
Template Code: https://github.com/hsingh904/routing-using-property-file