Class CdcSourceTaskContext


  • public class CdcSourceTaskContext
    extends Object
    Contains contextual information and objects scoped to the lifecycle of Debezium's SourceTask implementations.
    Author:
    Gunnar Morling
    • 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.
    • 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 - if contextName 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 null
        contextName - the name of the context; may not be null
        operation - 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()