Class LogMinerStreamingChangeEventSource

  • All Implemented Interfaces:
    io.debezium.pipeline.source.spi.ChangeEventSource, io.debezium.pipeline.source.spi.StreamingChangeEventSource<io.debezium.connector.oracle.OraclePartition,​io.debezium.connector.oracle.OracleOffsetContext>
    Direct Known Subclasses:
    OracleStreamFetchTask.RedoLogSplitReadTask

    public class LogMinerStreamingChangeEventSource
    extends Object
    implements io.debezium.pipeline.source.spi.StreamingChangeEventSource<io.debezium.connector.oracle.OraclePartition,​io.debezium.connector.oracle.OracleOffsetContext>
    Copied from Debezium 1.9.8.Final. A StreamingChangeEventSource based on Oracle's LogMiner utility. The event handler loop is executed in a separate executor.

    Diff: Make createProcessor method as protected to produce a LogMinerEventProcessor with enhanced processRow method to distinguish whether is bounded.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource

        io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext
    • Constructor Summary

      Constructors 
      Constructor Description
      LogMinerStreamingChangeEventSource​(io.debezium.connector.oracle.OracleConnectorConfig connectorConfig, io.debezium.connector.oracle.OracleConnection jdbcConnection, io.debezium.pipeline.EventDispatcher<io.debezium.connector.oracle.OraclePartition,​io.debezium.relational.TableId> dispatcher, io.debezium.pipeline.ErrorHandler errorHandler, io.debezium.util.Clock clock, io.debezium.connector.oracle.OracleDatabaseSchema schema, io.debezium.config.Configuration jdbcConfig, io.debezium.connector.oracle.OracleStreamingChangeEventSourceMetrics streamingMetrics)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void commitOffset​(Map<String,​?> offset)  
      protected io.debezium.connector.oracle.logminer.processor.LogMinerEventProcessor createProcessor​(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context, io.debezium.connector.oracle.OraclePartition partition, io.debezium.connector.oracle.OracleOffsetContext offsetContext)  
      void endMiningSession​(io.debezium.connector.oracle.OracleConnection connection, io.debezium.connector.oracle.OracleOffsetContext offsetContext)
      End the current Oracle LogMiner session, if one is in progress.
      void execute​(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context, io.debezium.connector.oracle.OraclePartition partition, io.debezium.connector.oracle.OracleOffsetContext offsetContext)
      This is the loop to get changes from LogMiner.
      boolean startMiningSession​(io.debezium.connector.oracle.OracleConnection connection, io.debezium.connector.oracle.Scn startScn, io.debezium.connector.oracle.Scn endScn, int attempts)
      Starts a new Oracle LogMiner session.
      • Methods inherited from interface io.debezium.pipeline.source.spi.StreamingChangeEventSource

        executeIteration, init
    • Constructor Detail

      • LogMinerStreamingChangeEventSource

        public LogMinerStreamingChangeEventSource​(io.debezium.connector.oracle.OracleConnectorConfig connectorConfig,
                                                  io.debezium.connector.oracle.OracleConnection jdbcConnection,
                                                  io.debezium.pipeline.EventDispatcher<io.debezium.connector.oracle.OraclePartition,​io.debezium.relational.TableId> dispatcher,
                                                  io.debezium.pipeline.ErrorHandler errorHandler,
                                                  io.debezium.util.Clock clock,
                                                  io.debezium.connector.oracle.OracleDatabaseSchema schema,
                                                  io.debezium.config.Configuration jdbcConfig,
                                                  io.debezium.connector.oracle.OracleStreamingChangeEventSourceMetrics streamingMetrics)
    • Method Detail

      • execute

        public void execute​(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context,
                            io.debezium.connector.oracle.OraclePartition partition,
                            io.debezium.connector.oracle.OracleOffsetContext offsetContext)
        This is the loop to get changes from LogMiner.
        Specified by:
        execute in interface io.debezium.pipeline.source.spi.StreamingChangeEventSource<io.debezium.connector.oracle.OraclePartition,​io.debezium.connector.oracle.OracleOffsetContext>
        Parameters:
        context - change event source context
      • createProcessor

        protected io.debezium.connector.oracle.logminer.processor.LogMinerEventProcessor createProcessor​(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context,
                                                                                                         io.debezium.connector.oracle.OraclePartition partition,
                                                                                                         io.debezium.connector.oracle.OracleOffsetContext offsetContext)
      • startMiningSession

        public boolean startMiningSession​(io.debezium.connector.oracle.OracleConnection connection,
                                          io.debezium.connector.oracle.Scn startScn,
                                          io.debezium.connector.oracle.Scn endScn,
                                          int attempts)
                                   throws SQLException
        Starts a new Oracle LogMiner session.

        When this is called, LogMiner prepares all the necessary state for an upcoming LogMiner view query. If the mining statement defines using DDL tracking, the data dictionary will be mined as a part of this call to prepare DDL tracking state for the upcoming LogMiner view query.

        Parameters:
        connection - database connection, should not be null
        startScn - mining session's starting system change number (exclusive), should not be null
        endScn - mining session's ending system change number (inclusive), can be null
        attempts - the number of mining start attempts
        Returns:
        true if the session was started successfully, false if it should be retried
        Throws:
        SQLException - if mining session failed to start
      • endMiningSession

        public void endMiningSession​(io.debezium.connector.oracle.OracleConnection connection,
                                     io.debezium.connector.oracle.OracleOffsetContext offsetContext)
                              throws SQLException
        End the current Oracle LogMiner session, if one is in progress. If the current session does not have an active mining session, a log message is recorded and the method is a no-op.
        Parameters:
        connection - database connection, should not be null
        offsetContext - connector offset context, should not be null
        Throws:
        SQLException - if the current mining session cannot be ended gracefully
      • commitOffset

        public void commitOffset​(Map<String,​?> offset)
        Specified by:
        commitOffset in interface io.debezium.pipeline.source.spi.StreamingChangeEventSource<io.debezium.connector.oracle.OraclePartition,​io.debezium.connector.oracle.OracleOffsetContext>