It is possible to set a time-to-live parameter for all endpoints, via the REST and SOAP Service Locator services, so make sure they are both started to be able to use the time-to-live feature.
Time to live means how long this endpoint should be considered active since the moment at which the time to live of the endpoint is set up. When this time is over, then the endpoint is considered inactive and may be automatically unregistered.
This feature can be used by non-ESB Providers (.NET Provider, non ESB Java Provider, for example), in case they can not unregister themselves correctly, due to a non graceful shutdown, a platform that might not allow this, a broken network, and so on. If this is the case, then the Provider should call this REST/SOAP operation to just update the endpoint's time-to-live in regular time intervals (which the non-ESB Provider has to implement on its own). This update is done via an updateTimetolive method, to make sure the non-ESB Provider endpoint is "online" until the specified time to live is over, everytime it is registered. This will lead to the following behaviours:
When the updateTimetolive method is used on an "online" endpoint, it remains "online" but becomes "expirable", which means it will automatically become "offline" when the specified time to live is over.
Invoking updateTimetolive on an endpoint which is "online" and already has a time-to-live, will reset the time-to-live to the new value.
Invoking updateTimetolive on "offline" endpoint will bring the endpoint "online" and set the specified time-to-live for it.
Re-registering an endpoint (which means invoking the registering of an endpoint which is already registered) which has time-to-live, will keep it "online" but will erase the time-to-live flag (which means it will make the endpoint non-expirable). But, calling the updateTimetolive method after that will make the endpoint expirable again.
Then, Service Locator internally checks that endpoints whose time-to-live is over are being unregistered automatically. This check is only enabled when the REST or SOAP Services are started for the Service Locator.
The AutoUnregister feature can be configured in the Talend Runtime Container configuration file org.talend.esb.locator.cfg:
To disable the feature, the property
locator.endpoints.timetolive.check should be set to false. In this case, there will have no check for
expired endpoints, even when the REST or SOAP services are started.
To define the interval between two checks, set the value of the property
locator.endpoints.timetolive.interval in seconds.
Example of SOAP request that sets time-to-live for the CRMService endpoint to be five minutes from now:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://talend.org/schemas/esb/locator/2011/11"> <soapenv:Header/> <soapenv:Body> <ns:updateTimetolive> <ns:serviceName xmlns:ns4="http://services.talend.org/CRMService">ns4:CRMServiceProvider</ns:serviceName> <ns:endpointURL>http://localhost:8040/services/CRMServiceProvider</ns:endpointURL> <ns:timetolive>300</ns:timetolive> </ns:updateTimetolive> </soapenv:Body> </soapenv:Envelope>
Example of PUT request to the Service Locator REST service: