Class DataRoutingServiceCachingImpl
java.lang.Object
com.illumon.iris.db.v2.routing.DataRoutingService.Delegating
com.illumon.iris.db.v2.routing.impl.yaml.DataRoutingServiceCachingImpl
- All Implemented Interfaces:
DataRoutingConfigListener
,DataRoutingService
,StorageLookup
,EndpointResolver
,ClaimsProvider
,SafeCloseable
,NamedImplementation
,AutoCloseable
public class DataRoutingServiceCachingImpl
extends DataRoutingService.Delegating
implements DataRoutingConfigListener
A caching implementation of DataRoutingService that listens for changes to the source service and updates the delegate
when changes are detected. This can prevent unnecessary remote calls.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
DataRoutingService.DeferredEndpoint, DataRoutingService.Delegating, DataRoutingService.Endpoint, DataRoutingService.EndpointConfig, DataRoutingService.NonListening, DataRoutingService.NotReadyException, DataRoutingService.NullPropertyProvider, DataRoutingService.PropertyProvider
-
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
DEFAULT_LOCAL_TABLE_DATA_SERVICE, DEFAULT_QUERY_SERVER_TABLE_DATA_SERVICE, DEFAULT_SELECTION_TAG, HOST_TAG, MERGE_QUERY_TDS_TAG, NULL_PROPERTY_PROVIDER, PORT_TAG, QUERY_QUERY_TDS_TAG, SERVICE_REGISTRY_NONE, SERVICE_REGISTRY_SERVICE, TABLE_DATA_PORT_TAG, TABLE_DATA_SERVICE_CONFIG_PROP, TABLE_DATA_SERVICE_CONFIG_PROPS_WITH_LEGACY, TAILER_PORT_TAG, VALIDATE_QUERY_TDS_TAG
-
Constructor Summary
ConstructorsConstructorDescriptionDataRoutingServiceCachingImpl
(DataRoutingService sourceDelegate) Create a new caching service that listens for changes to the remote service and keeps a local YAML implementation to fulfill requests. -
Method Summary
Modifier and TypeMethodDescriptionabout()
Information about a DataRoutingService instance.protected DataRoutingService
long
listen
(DataRoutingConfigListener listener) Add a listener for changes to the DataRoutingService configuration.void
onConfigChange
(long version) Called when the configuration changes.boolean
removeListener
(DataRoutingConfigListener listener) Remove the given listener from the list of listeners.Perform any lookups and transformations required to convert aLogAggregatorConfig.EndpointConfig
into aLogAggregatorConfig.Endpoint
that can be used for logging to a log aggregator service.Perform any lookups and transformations required to convert aDataRoutingService.EndpointConfig
into aDataRoutingService.Endpoint
that can be used to connect to a remote table data service.Perform any lookups and transformations required to convert aDataImportServiceConfig.EndpointConfig
into aDataImportServiceConfig.Endpoint
that can be used to connect to a DIS tailer service.boolean
Probe the implementation to find out if change notification is supported.Methods inherited from class com.illumon.iris.db.v2.routing.DataRoutingService.Delegating
asYamlString, close, getAllDataImportServiceConfigs, getAllDataImportServiceDestinationConfigs, getAllLogAggregatorServiceConfigs, getCollectedClaims, getDataImportServiceConfig, getDataImportServiceDestinationConfigs, getLogAggregatorConfig, getLogAggregatorDestinationConfig, getStorage, getTableDataServiceConfig, getTableDataServiceConfigs, registerClaims
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
authenticate, authenticate, authenticate, getAllDataImportServiceConfigs, getAllDataImportServiceDeferredDestinations, getAllDataImportServiceDestinations, getDataImportServiceConfigWithStorage, getDataImportServiceDeferredDestinations, getDataImportServiceDestinations, getLocalInstance, getLogAggregatorDeferredDestination, getLogAggregatorDestination
Methods inherited from interface com.illumon.util.type.NamedImplementation
getImplementationName
-
Constructor Details
-
DataRoutingServiceCachingImpl
Create a new caching service that listens for changes to the remote service and keeps a local YAML implementation to fulfill requests.- Parameters:
sourceDelegate
- the source service to listen to (e.g. a remote service)
-
-
Method Details
-
getDelegate
- Specified by:
getDelegate
in classDataRoutingService.Delegating
-
about
Description copied from interface:DataRoutingService
Information about a DataRoutingService instance. Useful for debugging.- Specified by:
about
in interfaceDataRoutingService
- Specified by:
about
in classDataRoutingService.Delegating
- Returns:
- a string containing information about the instance
-
resolveTailerEndpoint
@NotNull public DataImportServiceConfig.DeferredEndpoint resolveTailerEndpoint(@NotNull DataImportServiceConfig.EndpointConfig config) Description copied from interface:EndpointResolver
Perform any lookups and transformations required to convert aDataImportServiceConfig.EndpointConfig
into aDataImportServiceConfig.Endpoint
that can be used to connect to a DIS tailer service.- Specified by:
resolveTailerEndpoint
in interfaceEndpointResolver
- Parameters:
config
- the endpoint configuration- Returns:
- an Endpoint for tailing data
-
resolveLogAggregatorEndpoint
@NotNull public LogAggregatorConfig.DeferredEndpoint resolveLogAggregatorEndpoint(LogAggregatorConfig.EndpointConfig config) Description copied from interface:EndpointResolver
Perform any lookups and transformations required to convert aLogAggregatorConfig.EndpointConfig
into aLogAggregatorConfig.Endpoint
that can be used for logging to a log aggregator service.- Specified by:
resolveLogAggregatorEndpoint
in interfaceEndpointResolver
- Parameters:
config
- the log aggregator endpoint configuration- Returns:
- an Endpoint for the configuration
-
resolveTableDataEndpoint
@NotNull public DataRoutingService.DeferredEndpoint resolveTableDataEndpoint(@NotNull DataRoutingService.EndpointConfig config) Description copied from interface:EndpointResolver
Perform any lookups and transformations required to convert aDataRoutingService.EndpointConfig
into aDataRoutingService.Endpoint
that can be used to connect to a remote table data service.- Specified by:
resolveTableDataEndpoint
in interfaceEndpointResolver
- Parameters:
config
- the table data service endpoint configuration- Returns:
- the table data service endpoint
-
supportsChangeNotification
public boolean supportsChangeNotification()Description copied from interface:DataRoutingService
Probe the implementation to find out if change notification is supported.- Specified by:
supportsChangeNotification
in interfaceDataRoutingService
- Overrides:
supportsChangeNotification
in classDataRoutingService.Delegating
- Returns:
- true if change notifications are supported.
-
listen
Description copied from interface:DataRoutingService
Add a listener for changes to the DataRoutingService configuration.- Specified by:
listen
in interfaceDataRoutingService
- Overrides:
listen
in classDataRoutingService.Delegating
- Parameters:
listener
- configuration change notices will be published to this listener- Returns:
- the current configuration version
-
removeListener
Description copied from interface:DataRoutingService
Remove the given listener from the list of listeners.- Specified by:
removeListener
in interfaceDataRoutingService
- Overrides:
removeListener
in classDataRoutingService.Delegating
- Parameters:
listener
- the listener to remove- Returns:
- true if a listener was removed, false if it could not be found or could not be removed
-
onConfigChange
public void onConfigChange(long version) Description copied from interface:DataRoutingConfigListener
Called when the configuration changes. Additional heartbeat notifications are sent periodically.- Specified by:
onConfigChange
in interfaceDataRoutingConfigListener
- Parameters:
version
- the new/current version of the configuration.
-