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.Logger
log
Fields 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 String
about()
Information about a SchemaService instance.String
asYamlString()
This gets the input YAML, saved so it can be sent via grpc.void
close()
static DataRoutingServiceYmlImpl
fromFilename(String filename)
Create aDataRoutingServiceYmlImpl
instance from the named file.static DataRoutingServiceYmlImpl
fromString(String yml)
Create aDataRoutingServiceYmlImpl
from an existing String.Collection<? extends DataRoutingService.DataImportServiceEndpoint>
getAllDataImportServiceDestinations()
Get all known DIS destinations.Collection<? extends DataRoutingService.LogAggregatorConfig>
getAllLogAggregatorServiceConfigs()
DataRoutingService.DataImportServiceConfig
getDataImportServiceConfig(String name)
Get DIS parameters for this named DIS instance.Collection<? extends DataRoutingService.DataImportServiceEndpoint>
getDataImportServiceDestinations(TableIdentifier tableIdentifier)
Get DIS destinations for a table key.String
getImplementationName()
Get a name for the implementing class.DataRoutingService.LogAggregatorConfig
getLogAggregatorConfig(String name)
DataRoutingService.LogAggregatorEndpoint
getLogAggregatorDestination(TableIdentifier tableIdentifier)
Get the single LAS destination for the given table key.TableDataService
getTableDataService(String tdsName, boolean allowIOMessageFlush)
Get the named TableDataService, specifying the message flush behavior for RemoteTableDataService connections.DataRoutingService.TableDataServiceConfig
getTableDataServiceConfig(String name)
Information needed to configure a table data service server.Collection<? extends DataRoutingService.TableDataServiceConfig>
getTableDataServiceConfigs()
Get all known table data service configurations.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.protected RemoteTableDataService
makeRemoteTableDataService(String serviceName, String serverAddress, DataRoutingService.PropertyProvider properties, boolean allowIOMessageFlush)
Create a new RemoteTableDataService, allowing for subclass overrides for testing.String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
asYamlString
in interfaceDataRoutingService
- Returns:
- YAML representation of the configuration
-
fromFilename
Create aDataRoutingServiceYmlImpl
instance 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 aDataRoutingServiceYmlImpl
from 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:DataRoutingService
Information about a SchemaService instance. Useful for debugging.- Specified by:
about
in interfaceDataRoutingService
- Returns:
- a string containing information about the instance
-
getDataImportServiceConfig
@Nullable public DataRoutingService.DataImportServiceConfig getDataImportServiceConfig(@NotNull String name)Description copied from interface:DataRoutingService
Get DIS parameters for this named DIS instance. For consumption by a DIS instance or TableDataService consumer.- Specified by:
getDataImportServiceConfig
in 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:DataRoutingService
Get DIS destinations for a table key. For consumption by a Tailer.- Specified by:
getDataImportServiceDestinations
in 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:DataRoutingService
Get all known DIS destinations. For consumption by a Tailer.- Specified by:
getAllDataImportServiceDestinations
in interfaceDataRoutingService
- Returns:
- a possibly null collection of all known DIS destinations.
-
getLogAggregatorConfig
- Specified by:
getLogAggregatorConfig
in interfaceDataRoutingService
-
getLogAggregatorDestination
public DataRoutingService.LogAggregatorEndpoint getLogAggregatorDestination(@NotNull TableIdentifier tableIdentifier)Description copied from interface:DataRoutingService
Get 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:
getLogAggregatorDestination
in 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:DataRoutingService
Get 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:
getTableDataService
in 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:DataRoutingService
Information needed to configure a table data service server. For use by a TableDataService provider (LocalTableDataServer
,TableDataCacheProxy
).- Specified by:
getTableDataServiceConfig
in 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:DataRoutingService
Get all known table data service configurations. The data includes name description and tags.- Specified by:
getTableDataServiceConfigs
in interfaceDataRoutingService
- Returns:
- all known TableDataServiceConfigs
-
getAllLogAggregatorServiceConfigs
@NotNull public Collection<? extends DataRoutingService.LogAggregatorConfig> getAllLogAggregatorServiceConfigs()- Specified by:
getAllLogAggregatorServiceConfigs
in interfaceDataRoutingService
-
getImplementationName
Description copied from interface:NamedImplementation
Get a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendable
or overridetoString
.The default implementation is correct, but not suitable for high-frequency usage.
- Specified by:
getImplementationName
in interfaceNamedImplementation
- Returns:
- A name for the implementing class
-
close
public void close()- Specified by:
close
in 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
-