org.apache.ignite.cdc

## Interface CdcConsumer

-     public interface CdcConsumer

  Consumer of WAL data change events. This consumer will receive data change events during `CdcMain` application invocation. The lifecycle of the consumer is the following:
  - Start of the consumer `start(MetricRegistry)`.
  - Notification of the consumer by the `onEvents(Iterator)` call.
  - Stop of the consumer `stop()`.
  In case consumer implementation wants to user `IgniteLogger`, please, use, `LoggerResource` annotation:

       public class ChangeDataCaptureConsumer implements ChangeDataCaptureConsumer {
           @LoggerResource
           private IgniteLogger log;

           ...
       }

  Note, consumption of the `CdcEvent` will be started from the last saved offset. The offset of consumptions is saved on the disk every time `onEvents(Iterator)` returns `true`.
  See Also:
    `CdcMain`, `CdcEvent`, `CacheEntryVersion`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `onEvents(Iterator<CdcEvent> events)` Handles entry changes events.
    `void` | `start(org.apache.ignite.internal.processors.metric.MetricRegistry mreg)` Starts the consumer.
    `void` | `stop()` Stops the consumer.

- - ### Method Detail

    - #### start

          void start(org.apache.ignite.internal.processors.metric.MetricRegistry mreg)

      Starts the consumer.
      Parameters:
        `mreg` - Metric registry for consumer specific metrics.

    - #### onEvents

          boolean onEvents(Iterator<CdcEvent> events)

      Handles entry changes events. If this method return `true` then current offset will be stored and ongoing notifications after CDC application fail/restart will be started from it.
      Parameters:
        `events` - Entry change events.
      Returns:
        `True` if current offset should be saved on the disk to continue from it in case any failures or restart.

    - #### stop

          void stop()

      Stops the consumer. This methods can be invoked only after `start(MetricRegistry)`.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022