The Service Callout policy allows calling an external service (third party API) from your API flow. Using a Service Callout policy, you can configure an API proxy to make multiple API calls to deliver relevant geolocation data, customer reviews, items from a partner’s retail catalog, and so on. The service can be either an HTTP service or a JMS service. The target(s) to be invoked can be configured using Targets section.
Configuration
The configuration encapsulates different alternatives for the back end server that is used to perform the required information. The load balancing strategy allows multiple identical services hosted on different servers or different types of servers. It is possible to load balance between an HTTP service and a JMS service.
Load Balancing Strategy
Two types of Load Balancing strategies are Round Robin and Weighted Round Robin.
Round Robin
This default algorithm forwards a request to each Target Server in the order in which the servers are listed in the Target Configuration ID. You can select the configured target from the Target Configuration ID drop-down and you may add more targets to the list by clicking the Add button.
Figure 1: Round Robin Load Balancing Strategy
Weighted Round Robin
The Weighted Round Robin algorithm enables you to configure proportional traffic loads for your Target Servers. It distributes requests to your Target Servers following the weight set for them. The targets which are chosen in Round Robin strategy reflect under Weighted Round Robin where you can set the respective weight values as required. You may add more targets which are existing by clicking the Add button; the newly added targets reflect under Round Robin strategy also.
Figure 2: Weighted Round Robin Load Balancing Strategy
Examples
Using Authorization Services
Consider a case where an API needs to invoke a third party service for authorization. In such cases, the authorization service can be invoked using a service call out. the response from the call out can be parsed using the Assign Variables Policy and the resultant variables can be used to send error or carry forward with invoking the target service.
Using JMS Targets
JMS targets are invoked as a JMS requestor. Each request to the JMS system is sent with a property RequestorID and a Header JMSCorrelationID. These properties must be retained in the response message sent on the response destination.
When used with Fiorano ESB, JMS Replier micro service can be used to act as the JMS targets.