Class DataRoutingServiceYmlImpl
java.lang.Object
com.illumon.iris.db.v2.configuration.DataRoutingServiceYmlImpl
- All Implemented Interfaces:
DataRoutingService,NamedImplementation,AutoCloseable
public class DataRoutingServiceYmlImpl extends Object implements DataRoutingService
Reads data routing instructions from a YAML file.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.configuration.DataRoutingService
DataRoutingService.DataImportServiceConfig, DataRoutingService.DataImportServiceEndpoint, DataRoutingService.Delegating, DataRoutingService.Endpoint, DataRoutingService.Filter, DataRoutingService.ListFilter, DataRoutingService.LocationFilter, DataRoutingService.LogAggregatorConfig, DataRoutingService.LogAggregatorEndpoint, DataRoutingService.NullFilter, DataRoutingService.NullPropertyProvider, DataRoutingService.PropertyProvider, DataRoutingService.TableDataServiceConfig, DataRoutingService.TableFilter -
Field Summary
Fields Modifier and Type Field Description protected com.fishlib.io.logger.LoggerlogFields inherited from interface com.illumon.iris.db.v2.configuration.DataRoutingService
DEFAULT_LOCAL_TABLE_DATA_SERVICE, DEFAULT_QUERY_SERVER_TABLE_DATA_SERVICE, DEFAULT_SELECTION_TAG, MERGE_QUERY_TDS_TAG, NULL_FILTER, NULL_PROPERTY_PROVIDER, QUERY_QUERY_TDS_TAG, TABLE_DATA_SERVICE_CONFIG_PROP, TABLE_DATA_SERVICE_CONFIG_PROPS_WITH_LEGACY, VALIDATE_QUERY_TDS_TAG -
Method Summary
Modifier and Type Method Description Stringabout()Information about a SchemaService instance.StringasYamlString()This gets the input YAML, saved so it can be sent via grpc.voidclose()static DataRoutingServiceYmlImplfromFilename(String filename)Create aDataRoutingServiceYmlImplinstance from the named file.static DataRoutingServiceYmlImplfromString(String yml)Create aDataRoutingServiceYmlImplfrom an existing String.Collection<? extends DataRoutingService.DataImportServiceEndpoint>getAllDataImportServiceDestinations()Get all known DIS destinations.Collection<? extends DataRoutingService.LogAggregatorConfig>getAllLogAggregatorServiceConfigs()DataRoutingService.DataImportServiceConfiggetDataImportServiceConfig(String name)Get DIS parameters for this named DIS instance.Collection<? extends DataRoutingService.DataImportServiceEndpoint>getDataImportServiceDestinations(TableIdentifier tableIdentifier)Get DIS destinations for a table key.StringgetImplementationName()Get a name for the implementing class.DataRoutingService.LogAggregatorConfiggetLogAggregatorConfig(String name)DataRoutingService.LogAggregatorEndpointgetLogAggregatorDestination(TableIdentifier tableIdentifier)Get the single LAS destination for the given table key.TableDataServicegetTableDataService(String tdsName, boolean allowIOMessageFlush)Get the named TableDataService, specifying the message flush behavior for RemoteTableDataService connections.DataRoutingService.TableDataServiceConfiggetTableDataServiceConfig(String name)Information needed to configure a table data service server.Collection<? extends DataRoutingService.TableDataServiceConfig>getTableDataServiceConfigs()Get all known table data service configurations.protected RemoteTableDataServicemakeRemoteTableDataService(com.fishlib.io.sched.Scheduler scheduler, com.fishlib.io.logger.Logger log, String name, long requestTimeoutMillis, boolean supportsSubscriptions, boolean allowIOMessageFlush)Create a new RemoteTableDataService, allowing for subclass overrides for testing.protected RemoteTableDataServicemakeRemoteTableDataService(String serviceName, String serverAddress, DataRoutingService.PropertyProvider properties, boolean allowIOMessageFlush)Create a new RemoteTableDataService, allowing for subclass overrides for testing.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.configuration.DataRoutingService
authenticate, authenticate, authenticate, getTableDataService
-
Field Details
-
log
protected final com.fishlib.io.logger.Logger log
-
-
Method Details
-
asYamlString
This gets the input YAML, saved so it can be sent via grpc.- Specified by:
asYamlStringin interfaceDataRoutingService- Returns:
- YAML representation of the configuration
-
fromFilename
Create aDataRoutingServiceYmlImplinstance from the named file. This disambiguates the constructors.- Parameters:
filename- the name of the file to parse- Returns:
- a new DataRoutingService
- Throws:
IOException
-
fromString
Create aDataRoutingServiceYmlImplfrom an existing String. This allows storage and parsing to be independent.- Parameters:
yml- the string to parse- Returns:
- a new DataRoutingService
-
about
Description copied from interface:DataRoutingServiceInformation about a SchemaService instance. Useful for debugging.- Specified by:
aboutin interfaceDataRoutingService- Returns:
- a string containing information about the instance
-
getDataImportServiceConfig
@Nullable public DataRoutingService.DataImportServiceConfig getDataImportServiceConfig(@NotNull String name)Description copied from interface:DataRoutingServiceGet DIS parameters for this named DIS instance. For consumption by a DIS instance or TableDataService consumer.- Specified by:
getDataImportServiceConfigin interfaceDataRoutingService- Parameters:
name- DIS configuration name- Returns:
- the configuration for the named DIS, or null if it does not exist.
-
getDataImportServiceDestinations
@NotNull public Collection<? extends DataRoutingService.DataImportServiceEndpoint> getDataImportServiceDestinations(@NotNull TableIdentifier tableIdentifier)Description copied from interface:DataRoutingServiceGet DIS destinations for a table key. For consumption by a Tailer.- Specified by:
getDataImportServiceDestinationsin interfaceDataRoutingService- Parameters:
tableIdentifier- the identifier of the data to be logged- Returns:
- a possibly empty collection of DIS destinations that should receive data for the given table.
-
getAllDataImportServiceDestinations
@NotNull public Collection<? extends DataRoutingService.DataImportServiceEndpoint> getAllDataImportServiceDestinations()Description copied from interface:DataRoutingServiceGet all known DIS destinations. For consumption by a Tailer.- Specified by:
getAllDataImportServiceDestinationsin interfaceDataRoutingService- Returns:
- a possibly null collection of all known DIS destinations.
-
getLogAggregatorConfig
- Specified by:
getLogAggregatorConfigin interfaceDataRoutingService
-
getLogAggregatorDestination
public DataRoutingService.LogAggregatorEndpoint getLogAggregatorDestination(@NotNull TableIdentifier tableIdentifier)Description copied from interface:DataRoutingServiceGet the single LAS destination for the given table key. Must support defaults (e.g. to localhost). TODO: it would be nice to make this a little more generic, so one config also toggles between LAS and direct-to-file options. e.g. a token to give to Logger Factory- Specified by:
getLogAggregatorDestinationin interfaceDataRoutingService- Parameters:
tableIdentifier- the identifier of the data to be logged- Returns:
- the configured LogAggregatorEndpoint for the given tableIdentifier, or null if none match the key.
-
getTableDataService
@Nullable public TableDataService getTableDataService(@NotNull String tdsName, boolean allowIOMessageFlush) throws IOExceptionDescription copied from interface:DataRoutingServiceGet the named TableDataService, specifying the message flush behavior for RemoteTableDataService connections. allowIOMessageFlush == true is unsuitable for interactive or other applications where threads might be interrupted.- Specified by:
getTableDataServicein interfaceDataRoutingService- Parameters:
tdsName- the name of a configured TableDataServiceallowIOMessageFlush- value to be passed intoRemoteTableDataService's constructor- Returns:
- the named TableDataService, or null if not found.
- Throws:
IOException
-
getTableDataServiceConfig
@Nullable public DataRoutingService.TableDataServiceConfig getTableDataServiceConfig(@NotNull String name)Description copied from interface:DataRoutingServiceInformation needed to configure a table data service server. For use by a TableDataService provider (LocalTableDataServer,TableDataCacheProxy).- Specified by:
getTableDataServiceConfigin interfaceDataRoutingService- Parameters:
name- configuration name- Returns:
- the named TableDataServiceConfig, or null if not found.
-
getTableDataServiceConfigs
@NotNull public Collection<? extends DataRoutingService.TableDataServiceConfig> getTableDataServiceConfigs()Description copied from interface:DataRoutingServiceGet all known table data service configurations. The data includes name description and tags.- Specified by:
getTableDataServiceConfigsin interfaceDataRoutingService- Returns:
- all known TableDataServiceConfigs
-
getAllLogAggregatorServiceConfigs
@NotNull public Collection<? extends DataRoutingService.LogAggregatorConfig> getAllLogAggregatorServiceConfigs()- Specified by:
getAllLogAggregatorServiceConfigsin interfaceDataRoutingService
-
getImplementationName
Description copied from interface:NamedImplementationGet a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendableor overridetoString.The default implementation is correct, but not suitable for high-frequency usage.
- Specified by:
getImplementationNamein interfaceNamedImplementation- Returns:
- A name for the implementing class
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
makeRemoteTableDataService
@TestUseOnly protected RemoteTableDataService makeRemoteTableDataService(com.fishlib.io.sched.Scheduler scheduler, com.fishlib.io.logger.Logger log, String name, long requestTimeoutMillis, boolean supportsSubscriptions, boolean allowIOMessageFlush)Create a new RemoteTableDataService, allowing for subclass overrides for testing.- Parameters:
scheduler- Job schedulerlog- Logger for outputname- Remote service namerequestTimeoutMillis- The timeout value to use for all requestssupportsSubscriptions- Whether the service underlying the the TableDataServiceExporter we connect to supports subscriptionsallowIOMessageFlush- allow synchronous flush of message buffers- Returns:
- a new RemoteTableDataService, ready to be connected
-
makeRemoteTableDataService
protected RemoteTableDataService makeRemoteTableDataService(String serviceName, String serverAddress, @NotNull DataRoutingService.PropertyProvider properties, boolean allowIOMessageFlush)Create a new RemoteTableDataService, allowing for subclass overrides for testing. This override assumes some of the parameters needed to construct a RemoteTableDataService.- Parameters:
serviceName- The name to give the remote service- Returns:
- a new RemoteTableDataService, ready to be connected
-
toString
-