Class TableDataServiceFactory

java.lang.Object
com.illumon.iris.db.v2.tabledataservice.TableDataServiceFactory
All Implemented Interfaces:
DynamicResolverMixin, EndpointResolver

public class TableDataServiceFactory extends Object implements DynamicResolverMixin
The standard factory for creating TableDataService instances using a DataRoutingService instance
  • Field Details

    • DEFAULT_TABLE_DATA_SERVICE_REQUEST_TIMEOUT_MILLIS

      public static final long DEFAULT_TABLE_DATA_SERVICE_REQUEST_TIMEOUT_MILLIS
      See Also:
    • log

      protected final com.fishlib.io.logger.Logger log
  • Constructor Details

  • Method Details

    • getTableDataServiceConfig

      public TableDataServiceConfig getTableDataServiceConfig(@NotNull String name)
      Create a TableDataServiceConfig that is fully formed and functional (i.e. also a valid TableDataService) For internal use only.
      Parameters:
      name - the name of the config to load
      Returns:
      the named TableDataServiceConfig, or null if it does not exist.
    • getOrCreateTableDataService

      public TableDataService getOrCreateTableDataService(@NotNull String tdsName, boolean allowIOMessageFlush, boolean forProducer) throws IOException
      Get a TableDataService based on the routing instructions provided by the DataRoutingService provided at construction time. The returned service may be new, or it may be a cached, previously created one.
      Parameters:
      tdsName - the name of the table data service to create
      allowIOMessageFlush - pass-through to RemoteTableDataService: allow synchronous flush of message buffers
      forProducer - if the resultant TableDataService is for a producer such as a TDCP
      Returns:
      a TableDataService which may or may not be a complex composition of other services.
      Throws:
      IOException
    • getOrCreateTableDataService

      @NotNull public TableDataService getOrCreateTableDataService(@NotNull TableDataServiceConfig tableDataServiceConfig, boolean allowIOMessageFlush, boolean forProducer) throws IOException
      Create the TableDataService starting with an actual TableDataServiceConfig instance
      Parameters:
      tableDataServiceConfig - the TableDataServiceConfig instance (from the map)
      allowIOMessageFlush - boolean to be passed to Remote TDS. Should be false for queries. This is needed because this method is called recursively.
      forProducer - the caller is a producer if true, else consumer. Consumers just connect to the config, producers connect to the embedded services and provide a remote TDS endpoint.
      Returns:
      a TableDataService as configured
      Throws:
      DataRoutingConfigurationException - if the configuration is invalid
      IOException
    • makeRemoteTableDataService

      @TestUseOnly protected RemoteTableDataService makeRemoteTableDataService(@NotNull com.fishlib.io.sched.Scheduler scheduler, @NotNull com.fishlib.io.logger.Logger log, @NotNull String name, long requestTimeoutMillis, boolean supportsSubscriptions, boolean allowIOMessageFlush)
      Create a new RemoteTableDataService, allowing for subclass overrides for testing.
      Parameters:
      scheduler - Job scheduler
      log - Logger for output
      name - Remote service name
      requestTimeoutMillis - The timeout value to use for all requests
      supportsSubscriptions - Whether the service underlying the the TableDataServiceExporter we connect to supports subscriptions
      allowIOMessageFlush - allow synchronous flush of message buffers
      Returns:
      a new RemoteTableDataService, ready to be connected
    • makeRemoteTableDataService

      protected RemoteTableDataService makeRemoteTableDataService(@NotNull String serviceName, @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
      properties - provider of property values that might be used by TDS implementations
      allowIOMessageFlush - passthru to RemoteTableDataService: allow synchronous flush of message buffers
      Returns:
      a new RemoteTableDataService, ready to be connected
    • makeRemoteConnections

      public boolean makeRemoteConnections(boolean makeThem)
      Set the value of makeRemoteConnections. If true (the default), remote connections will be initiated when a TableDataService is created. Disabling connections is useful for testing and diagnostic purposes.
      Parameters:
      makeThem - set makeRemoteConnections to this value.
      Returns:
      the previous value