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 ofPersistentDatathis sink stores
- All Implemented Interfaces:
DataConsumer<T>, DataSink<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
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractSink
AbstractSink.SinkWriter -
Field Summary
Fields inherited from class AbstractSink
batchSize, flavor, id, status, storeMetric -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractManagedSink(GatewayContext context, StorageKey storageKey, PersistentFlavor<T> flavor, int batchSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonStorageFailure(List<T> data, Exception e) Logs the failure at debug level and rethrows it as aDataStorageException, so the pipeline retains or quarantines the data.final voidsetAvailable(boolean available) Drives the sink'sACCEPTINGstate from the owner's availability signal:trueinitializesthe sink,falseuninitializesit.protected abstract voidstoreBatch(List<T> batch) Stores one batch synchronously (the forward thread blocks here); throw to signal failure.voidStores the data in batches of the configured size, doing nothing for null or empty input.Methods inherited from class AbstractSink
createLogger, getContext, getFaultError, getInfo, getLogger, getMetricPrefix, getStorageKey, getSupportedFlavor, getTypeDescription, getWriter, initialize, isAccepting, markStoreMetric, onFailure, onInitialize, onShutdown, onStartup, onUninitialize, shutdown, startup, toString, uninitialize, updateStatus, validateFlavorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DataConsumer
storeDataMethods inherited from interface DataSink
isEngineBound, withStorageKey
-
Constructor Details
-
AbstractManagedSink
protected AbstractManagedSink(GatewayContext context, StorageKey storageKey, PersistentFlavor<T> flavor, int batchSize) - Parameters:
context- the gateway contextstorageKey- the storage key identifying this sinkflavor- the persistent flavor (orFlavorContainer) this sink acceptsbatchSize- the number of items perstoreBatch(List)call; values<= 0mean one batch
-
-
Method Details
-
storeData
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 throughonStorageFailure(List, Exception), which rethrows as aDataStorageExceptionso the pipeline quarantines the data. A sink that is notacceptingalso 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
-
onStorageFailure
Logs the failure at debug level and rethrows it as aDataStorageException, so the pipeline retains or quarantines the data.- Parameters:
data- the data that failed to storee- the cause- Throws:
DataStorageException- always, wrappinge
-
setAvailable
public final void setAvailable(boolean available) Drives the sink'sACCEPTINGstate from the owner's availability signal:trueinitializesthe sink,falseuninitializesit.Idempotent, so owners can republish an unchanged signal: re-initializing an accepting sink would drop it out of
ACCEPTINGfor the length ofAbstractSink.onInitialize()and make concurrent writes throw.- Parameters:
available-trueif the backing system is available
-