All Implemented Interfaces:
DataConsumer<QuerySFData>, DataSink<QuerySFData>

public class DatasourceQuerySink extends AbstractDatasourceSink<QuerySFData>
A sink that executes queries to a datasource.
  • Constructor Details

    • DatasourceQuerySink

      public DatasourceQuerySink(GatewayContext context, String dataSource)
      Creates a new instance of this sink with the specified context and datasource. The default flavor for QuerySFData will be used as the sink's supported flavor.
      Parameters:
      context - the gateway context
      dataSource - the data source to execute the underling queries within QuerySFData
  • Method Details

    • storeToConnection

      protected void storeToConnection(SRConnection conn, List<QuerySFData> querySFData) throws Exception
      Description copied from class: AbstractDatasourceSink
      Stores the given data to the specified connection.
      Specified by:
      storeToConnection in class AbstractDatasourceSink<QuerySFData>
      Parameters:
      conn - the connection to store the data to
      querySFData - the data to be stored
      Throws:
      Exception - if there is an error storing the data
    • getTypeDescription

      protected @NonNull LocalizedString getTypeDescription()
      Specified by:
      getTypeDescription in class AbstractSink<QuerySFData>
    • withStorageKey

      public Optional<DataSink<QuerySFData>> withStorageKey(StorageKey storageKey, boolean matchPruning)
      Description copied from interface: DataSink
      Creates a new, independent sink of this type bound to the given storage key, reusing this sink's configuration. The new sink writes to the datasource named by StorageKey.engineId() of the supplied key, allowing data to be forwarded through a duplicate datasource without disturbing this (original) sink.

      The default implementation returns empty, indicating this sink type does not support copies (for example remote sinks, which forward to another gateway rather than a database). Datasource-backed sinks override this to reconstruct themselves against storageKey, carrying over their settings.

      Parameters:
      storageKey - the storage key the new sink should be bound to
      matchPruning - if the sink supports pruning, request that it match this sinks settings, otherwise disable pruning
      Returns:
      a new sink bound to storageKey, or empty if this sink type cannot be backfilled