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 DataRoutingServicelonglisten(DataRoutingConfigListener listener) Add a listener for changes to the DataRoutingService configuration.voidonConfigChange(long version) Called when the configuration changes.booleanremoveListener(DataRoutingConfigListener listener) Remove the given listener from the list of listeners.Perform any lookups and transformations required to convert aLogAggregatorConfig.EndpointConfiginto aLogAggregatorConfig.Endpointthat can be used for logging to a log aggregator service.Perform any lookups and transformations required to convert aDataRoutingService.EndpointConfiginto aDataRoutingService.Endpointthat can be used to connect to a remote table data service.Perform any lookups and transformations required to convert aDataImportServiceConfig.EndpointConfiginto aDataImportServiceConfig.Endpointthat can be used to connect to a DIS tailer service.booleanProbe 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, registerClaimsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.routing.DataRoutingService
authenticate, authenticate, authenticate, getAllDataImportServiceConfigs, getAllDataImportServiceDeferredDestinations, getAllDataImportServiceDestinations, getDataImportServiceConfigWithStorage, getDataImportServiceDeferredDestinations, getDataImportServiceDestinations, getLocalInstance, getLogAggregatorDeferredDestination, getLogAggregatorDestinationMethods 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:
getDelegatein classDataRoutingService.Delegating
-
about
Description copied from interface:DataRoutingServiceInformation about a DataRoutingService instance. Useful for debugging.- Specified by:
aboutin interfaceDataRoutingService- Specified by:
aboutin classDataRoutingService.Delegating- Returns:
- a string containing information about the instance
-
resolveTailerEndpoint
@NotNull public DataImportServiceConfig.DeferredEndpoint resolveTailerEndpoint(@NotNull DataImportServiceConfig.EndpointConfig config) Description copied from interface:EndpointResolverPerform any lookups and transformations required to convert aDataImportServiceConfig.EndpointConfiginto aDataImportServiceConfig.Endpointthat can be used to connect to a DIS tailer service.- Specified by:
resolveTailerEndpointin 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:EndpointResolverPerform any lookups and transformations required to convert aLogAggregatorConfig.EndpointConfiginto aLogAggregatorConfig.Endpointthat can be used for logging to a log aggregator service.- Specified by:
resolveLogAggregatorEndpointin 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:EndpointResolverPerform any lookups and transformations required to convert aDataRoutingService.EndpointConfiginto aDataRoutingService.Endpointthat can be used to connect to a remote table data service.- Specified by:
resolveTableDataEndpointin interfaceEndpointResolver- Parameters:
config- the table data service endpoint configuration- Returns:
- the table data service endpoint
-
supportsChangeNotification
public boolean supportsChangeNotification()Description copied from interface:DataRoutingServiceProbe the implementation to find out if change notification is supported.- Specified by:
supportsChangeNotificationin interfaceDataRoutingService- Overrides:
supportsChangeNotificationin classDataRoutingService.Delegating- Returns:
- true if change notifications are supported.
-
listen
Description copied from interface:DataRoutingServiceAdd a listener for changes to the DataRoutingService configuration.- Specified by:
listenin interfaceDataRoutingService- Overrides:
listenin classDataRoutingService.Delegating- Parameters:
listener- configuration change notices will be published to this listener- Returns:
- the current configuration version
-
removeListener
Description copied from interface:DataRoutingServiceRemove the given listener from the list of listeners.- Specified by:
removeListenerin interfaceDataRoutingService- Overrides:
removeListenerin 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:DataRoutingConfigListenerCalled when the configuration changes. Additional heartbeat notifications are sent periodically.- Specified by:
onConfigChangein interfaceDataRoutingConfigListener- Parameters:
version- the new/current version of the configuration.
-