Package io.debezium.connector.common
Class CdcSourceTaskContext
- java.lang.Object
-
- io.debezium.connector.common.CdcSourceTaskContext
-
public class CdcSourceTaskContext extends Object
Contains contextual information and objects scoped to the lifecycle of Debezium'sSourceTask
implementations.- Author:
- Gunnar Morling
-
-
Field Summary
Fields Modifier and Type Field Description private Clock
clock
private Supplier<Collection<? extends DataCollectionId>>
collectionsSupplier
Obtains the data collections captured at the point of invocation.private String
connectorName
private String
connectorType
-
Constructor Summary
Constructors Constructor Description CdcSourceTaskContext(String connectorType, String connectorName, Supplier<Collection<? extends DataCollectionId>> collectionsSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
capturedDataCollections()
LoggingContext.PreviousContext
configureLoggingContext(String contextName)
Configure the logger's Mapped Diagnostic Context (MDC) properties for the thread making this call.Clock
getClock()
Returns a clock for obtaining the current time.String
getConnectorName()
String
getConnectorType()
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 Detail
-
connectorType
private final String connectorType
-
connectorName
private final String connectorName
-
clock
private final Clock clock
-
collectionsSupplier
private final Supplier<Collection<? extends DataCollectionId>> collectionsSupplier
Obtains the data collections captured at the point of invocation.
-
-
Constructor Detail
-
CdcSourceTaskContext
public CdcSourceTaskContext(String connectorType, String connectorName, Supplier<Collection<? extends DataCollectionId>> collectionsSupplier)
-
-
Method Detail
-
configureLoggingContext
public LoggingContext.PreviousContext configureLoggingContext(String contextName)
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
-
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
public Clock getClock()
Returns a clock for obtaining the current time.
-
capturedDataCollections
public String[] capturedDataCollections()
-
getConnectorType
public String getConnectorType()
-
getConnectorName
public String getConnectorName()
-
-