Class DebeziumOpenLineageEmitter
This class serves as a facade for the underlying OpenLineage integration, providing static methods for initializing the emitter and emitting lineage events at various points in the Debezium connector lifecycle. The implementation uses a thread-safe approach to ensure proper initialization across multiple threads.
The emitter will only be active if OpenLineage integration is enabled in the configuration. Otherwise, a no-operation implementation is used that performs no actual emission.
- Author:
- Mario Fiore Vitale
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ConcurrentHashMap<String, LineageEmitter> private static final ServiceLoader<LineageEmitterFactory> private static final org.slf4j.Loggerprivate static NoOpLineageEmitterprivate static final Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanup(ConnectorContext connectorContext) Removes the emitter for the specified connector.static ConnectorContextstatic voidemit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state) Emits a lineage event for the given source task state.static voidemit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state, Throwable t) Emits a lineage event for the given source task state and exception.static voidemit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state, List<DatasetMetadata> datasetMetadata) Emits a lineage inputDatasetMetadata for the given source task state and table inputDatasetMetadata.static voidemit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state, List<DatasetMetadata> datasetMetadata, Throwable t) Emits a lineage event for the given source task state, table event, and exception.private static LineageEmittergetEmitter(ConnectorContext connectorContext) private static NoOpLineageEmitterprivate static LineageEmitterinit(ConnectorContext connectorContext) private static booleanisOpenLineageDisabled(ConnectorContext connectorContext)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
lineageEmitterFactory
-
SERVICE_LOADER_LOCK
-
emitters
-
noOpLineageEmitter
-
-
Constructor Details
-
DebeziumOpenLineageEmitter
public DebeziumOpenLineageEmitter()
-
-
Method Details
-
emit
public static void emit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state) Emits a lineage event for the given source task state.- Parameters:
connectorContext- The connector contextstate- The current state of the source task- Throws:
IllegalStateException- If the emitter has not been initialized for this connector
-
emit
public static void emit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state, Throwable t) Emits a lineage event for the given source task state and exception.This method is typically used for error reporting.
- Parameters:
connectorContext- The connector contextstate- The current state of the source taskt- The exception that occurred during processing- Throws:
IllegalStateException- If the emitter has not been initialized for this connector
-
emit
public static void emit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state, List<DatasetMetadata> datasetMetadata) Emits a lineage inputDatasetMetadata for the given source task state and table inputDatasetMetadata.This method is typically used for emitting input dataset lineage.
- Parameters:
connectorContext- The connector contextstate- The current state of the source taskdatasetMetadata- A list of input dataset metadata containing metadata for lineage- Throws:
IllegalStateException- If the emitter has not been initialized for this connector
-
emit
public static void emit(ConnectorContext connectorContext, io.debezium.connector.common.DebeziumTaskState state, List<DatasetMetadata> datasetMetadata, Throwable t) Emits a lineage event for the given source task state, table event, and exception.This method provides the most detailed lineage information, including both table metadata and any exception that occurred during processing.
- Parameters:
connectorContext- The connector contextstate- The current state of the source taskdatasetMetadata- A list of input dataset metadata containing metadata for lineaget- The exception that occurred during processing, may benull- Throws:
IllegalStateException- If the emitter has not been initialized for this connector
-
connectorContext
-
cleanup
Removes the emitter for the specified connector. Should be called when a connector is stopped or destroyed.- Parameters:
connectorContext- The context the connector
-
getEmitter
-
init
-
getNoOpLineageEmitter
-
isOpenLineageDisabled
-