Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleCDCConsumer.java
/** Consumer of WAL recordsdata change events. */
@IgniteExperimental
public interface CDCConsumerDataChangeListener<K, V> {
    /**
     * @return Consumer ID.
     */
    String id();

    /**
     * InitializeStarts thisthe consumer.
     *
     * @param configuration Ignite configuration.
     */
    void start(IgniteConfiguration configuration, IgniteLogger log);

    /**
     * @return {@code True} if entry key and value should be keeped in binary format.
     */
    boolean keepBinary();

    /**
     * Handles entry changes events.
     * If this method return {@code true} then current offset will be stored and ongoing notifications after CDC application fail/restart
     * will @parambe recordstarted WALfrom recordit.
     *
     * @param events <T>Entry Recordchange typeevents.
	     * @return {@code True} if state of the consumptioncurrent offset should be savedcommited.
     */
    <T extends WALRecord> booolean onRecord(T recordboolean onChange(Iterable<EntryEvent<K, V>> events);

    /**
     * Stops thisthe consumer.
     * This methods can be invoked only after {@link #start(IgniteConfiguration, IgniteLogger)}.
     */
    void stop();
}

/**
 * Event for single entry change.
 *
 * @param <K> Key type.
 * @param <V> Value type.
 */
@IgniteExperimental
public interface EntryEvent<K, V> {
    /**
     * @return Key for the changed entry.
     */
    public K key();

    /**
     * @return Value for the changed entry.
     */
    public V value();

    /**
     * @return {@code True} if event fired on primary node for partition containing this entry.
     * @see <a href="https://ignite.apache.org/docs/latest/configuring-caches/configuring-backups#configuring-partition-backups">Configuring partition backups.</a>
     */
    public boolean primary();

    /**
     * @return Operation type.
     */
    EntryEventType operation();

    /**
     * @return Cache ID.
     * @see org.apache.ignite.internal.util.typedef.internal.CU#cacheId(String)
     */
    long cacheId();

    /**
     * @return Expire time.
     */
    long expireTime();
}

/**
 * Event for single entry change.
 *
 * @param <K> Key type.
 * @param <V> Value type.
 */
@IgniteExperimental
public interface EntryEvent<K, V> {
    /**
     * @return Key for the changed entry.
     */
    public K key();

    /**
     * @return Value for the changed entry.
     */
    public V value();

    /**
     * @return {@code True} if event fired on primary node for partition containing this entry.
     * @see <a href="https://ignite.apache.org/docs/latest/configuring-caches/configuring-backups#configuring-partition-backups">Configuring partition backups.</a>
     */
    public boolean primary();

    /**
     * @return Operation type.
     */
    EntryEventType operation();

    /**
     * @return Cache ID.
     * @see org.apache.ignite.internal.util.typedef.internal.CU#cacheId(String)
     */
    long cacheId();

    /**
     * @return Expire time.
     */
    long expireTime();
}

Risks and Assumptions

...