Class AbstractManagedSink<T extends PersistentData>

java.lang.Object
com.inductiveautomation.ignition.gateway.storeforward.sinks.AbstractSink<T>
com.inductiveautomation.historian.gateway.api.storeforward.AbstractManagedSink<T>
Type Parameters:
T - the type of PersistentData this sink stores
All Implemented Interfaces:
DataConsumer<T>, DataSink<T>

public abstract class AbstractManagedSink<T extends PersistentData> extends AbstractSink<T>
Base class for Store & Forward sinks that write to a backend they manage themselves (their own connection pool or client) rather than a gateway Datasource. It keeps the batched storeData(List) contract of AbstractDatasourceSink without any datasource or JDBC coupling; subclasses implement storeBatch(List) to write one batch.

The owning component, such as a storage engine, drives the sink's ACCEPTING state through setAvailable(boolean) from its own availability signal.

Since:
2027.02
  • Constructor Details

    • AbstractManagedSink

      protected AbstractManagedSink(GatewayContext context, StorageKey storageKey, PersistentFlavor<T> flavor, int batchSize)
      Parameters:
      context - the gateway context
      storageKey - the storage key identifying this sink
      flavor - the persistent flavor (or FlavorContainer) this sink accepts
      batchSize - the number of items per storeBatch(List) call; values <= 0 mean one batch
  • Method Details

    • storeData

      public void storeData(List<T> data) throws DataStorageException
      Stores the data in batches of the configured size, doing nothing for null or empty input.

      Each batch goes to storeBatch(List); a failure is routed through onStorageFailure(List, Exception), which rethrows as a DataStorageException so the pipeline quarantines the data. A sink that is not accepting also throws, so the pipeline retains the data and retries.

      Parameters:
      data - the data to store
      Throws:
      DataStorageException - if the sink is not accepting, or a batch fails to store
    • storeBatch

      protected abstract void storeBatch(List<T> batch) throws Exception
      Stores one batch synchronously (the forward thread blocks here); throw to signal failure.
      Parameters:
      batch - the batch to store, never empty
      Throws:
      Exception - if the batch cannot be stored
    • onStorageFailure

      protected void onStorageFailure(List<T> data, Exception e) throws DataStorageException
      Logs the failure at debug level and rethrows it as a DataStorageException, so the pipeline retains or quarantines the data.
      Parameters:
      data - the data that failed to store
      e - the cause
      Throws:
      DataStorageException - always, wrapping e
    • setAvailable

      public final void setAvailable(boolean available)
      Drives the sink's ACCEPTING state from the owner's availability signal: true initializes the sink, false uninitializes it.

      Idempotent, so owners can republish an unchanged signal: re-initializing an accepting sink would drop it out of ACCEPTING for the length of AbstractSink.onInitialize() and make concurrent writes throw.

      Parameters:
      available - true if the backing system is available