Skip to main content

Configuring the Service Locator

To customize properties, edit the locator.properties in your classpath instead.

The following properties can be specified in the Service Locator configuration file:

Property name

Description

locator.endpoints Specifies the endpoints of all Service Locator instances available to clients. A Service Locator client will arbitrarily pick one of these endpoints to connect to the Service Locator until a connection is established. If the property is not set, the default localhost endpoint of localhost:2181 will be used.
endpoint.http.prefix Necessary when running in a container where the stated endpoints are relative to the container. The default value is an empty string, but typically it will be preset to a value such as : http://localhost:8040/services in the configuration file.
endpoint.https.prefix Necessary when running in a container where the endpoint is only relative to the container and secured. The default value is an empty string, but typically it will be preset to a value such as : https://localhost:9001/services in the configuration file.
locator.strategy The endpoint selection strategy to use, as defined in the previous section. Acceptable values are defaultSelectionStrategy, randomSelectionStrategy and evenDistributionSelectionStrategy.
locator.reloadA​d​r​essesCount This parameter is relevant only for evenDistributionSelectionStrategy and randomSelectionStrategy. These strategies cache the list of endpoints returned by the locator for a fixed number of service calls set by this parameter. After this number of calls, the list of available addresses will be refreshed. Set this parameter to a high value to reduce the number of locator refreshes if your services are proving reliable (for example, few failovers occurring).
connection.timeout Specifies the time (ms) the Service Locator client waits for a connection to get established. Must be greater than zero, with a default of 5000 ms.
session.timeout Specifies the timeout period in ms of the session established with the server. Sessions are kept alive by requests sent by the client. If a session becomes idle for a period approaching this timeout value, the client will send a ping request to keep the session alive. Must be greater than zero and less than 60000ms (1 minute), by default 5000 ms.
authentication.name and authentication.password Authentication properties for the Service Locator Client. Uncomment them to enable the Service Locator client to communicate with a secured locator server.

Here is an example of a zoo.cfg file:

    locator.endpoints=localhost:2181
    endpoint.http.prefix=http://localhost:8040/services
    endpoint.https.prefix=https://localhost:9001/services
    locator.strategy=defaultSelectionStrategy
    locator.reloadAddressesCount=10 
    connection.timeout=5000
    session.timeout=5000
    #authentication.name=tesb
    #authentication.password=tesb

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 – please let us know!