Skip to main content

Service Locator endpoint selection strategy configuration

Currently three endpoint selection strategies are supported: defaultSelectionStrategy, randomSelectionStrategy and evenDistributionSelectionStrategy.

  • defaultSelectionStrategy uses the same endpoint as long as there is no failover with no distribution between endpoints.

  • evenDistributionSelectionStrategy uses a client-side round robin strategy. For example, if there are three instances (endpoints), round robin uses sequential distribution: "1 2 3 1 2 3 1 2 3". If multiple clients use this strategy, it could happen that all clients choose subsequently the same endpoints since the locator instances for each client operate independently.

    In case of failover (for example if the second instance goes down), when the Service Locator client again executes a request for endpoints, it will just get the remaining endpoints (here, the first and third). One endpoint will be picked arbitrarily with the sequential distribution on remaining nodes resuming after that.

  • randomSelectionStrategy selects randomly from the available endpoints for each call. This strategy reduces the chances of clients choosing the same endpoints.

In summary, in case of failover, a random alternative endpoint is selected to start with, and then the selected strategy resumes as normal.

The selection strategy at a container level is configured in the properties file as described in Configuring Service Locator in the Talend Runtime Container and in Configuring the Service Locator by setting the locator.strategy property. If not configured, the defaultSelectionStrategy will be used.

The endpoint selection strategy can also be configured for each consumer by adding an additional property in the consumer configuration. For the consumer selection strategy setting, add the selectionStrategy property in the consumer endpoint configuration as shown below:

    <entry key="locator.strategy" value="randomSelectionStrategy" /> 

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!