Package io.debezium.connector.common
Class CdcSourceTaskContext
java.lang.Object
io.debezium.connector.common.CdcSourceTaskContext
Contains contextual information and objects scoped to the lifecycle of Debezium's
SourceTask
implementations.- Author:
- Gunnar Morling
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Clock
private final Supplier<Collection<? extends DataCollectionId>>
Obtains the data collections captured at the point of invocation.private final String
private final String
private final String
-
Constructor Summary
ConstructorDescriptionCdcSourceTaskContext
(String connectorType, String connectorName, String taskId, Map<String, String> customMetricTags, Supplier<Collection<? extends DataCollectionId>> collectionsSupplier) CdcSourceTaskContext
(String connectorType, String connectorName, Map<String, String> customMetricTags, Supplier<Collection<? extends DataCollectionId>> collectionsSupplier) -
Method Summary
Modifier and TypeMethodDescriptionString[]
configureLoggingContext
(String contextName) Configure the logger's Mapped Diagnostic Context (MDC) properties for the thread making this call.configureLoggingContext
(String contextName, Partition partition) getClock()
Returns a clock for obtaining the current time.void
temporaryLoggingContext
(CommonConnectorConfig connectorConfig, String contextName, Runnable operation) Run the supplied function in the temporary connector MDC context, and when complete always return the MDC context to its state before this method was called.
-
Field Details
-
connectorType
-
connectorName
-
taskId
-
customMetricTags
-
clock
-
collectionsSupplier
Obtains the data collections captured at the point of invocation.
-
-
Constructor Details
-
CdcSourceTaskContext
public CdcSourceTaskContext(String connectorType, String connectorName, String taskId, Map<String, String> customMetricTags, Supplier<Collection<? extends DataCollectionId>> collectionsSupplier) -
CdcSourceTaskContext
public CdcSourceTaskContext(String connectorType, String connectorName, Map<String, String> customMetricTags, Supplier<Collection<? extends DataCollectionId>> collectionsSupplier)
-
-
Method Details
-
configureLoggingContext
Configure the logger's Mapped Diagnostic Context (MDC) properties for the thread making this call.- Parameters:
contextName
- the name of the context; may not be null- Returns:
- the previous MDC context; never null
- Throws:
IllegalArgumentException
- ifcontextName
is null
-
configureLoggingContext
public LoggingContext.PreviousContext configureLoggingContext(String contextName, Partition partition) -
temporaryLoggingContext
public void temporaryLoggingContext(CommonConnectorConfig connectorConfig, String contextName, Runnable operation) Run the supplied function in the temporary connector MDC context, and when complete always return the MDC context to its state before this method was called.- Parameters:
connectorConfig
- the configuration of the connector; may not be nullcontextName
- the name of the context; may not be nulloperation
- the function to run in the new MDC context; may not be null- Throws:
IllegalArgumentException
- if any of the parameters are null
-
getClock
Returns a clock for obtaining the current time. -
capturedDataCollections
-
getConnectorType
-
getConnectorName
-
getTaskId
-
getCustomMetricTags
-