Class WalRecordsConsumer<K,​V>

    • Constructor Detail

      • WalRecordsConsumer

        public WalRecordsConsumer​(CdcConsumer consumer,
                                  IgniteLogger log)
        Parameters:
        consumer - User provided CDC consumer.
        log - Logger.
    • Method Detail

      • onRecords

        public boolean onRecords​(Iterator<DataEntry> entries,
                                 IgniteClosure<DataEntry,​CdcEvent> transform,
                                 @Nullable
                                 @Nullable IgnitePredicate<? super DataEntry> filter)
        Handles data entries. If this method return true then current offset in WAL and DataEntry index inside DataRecord will be stored and WAL iteration will be started from it on CDC application fail/restart.
        Parameters:
        entries - Data entries iterator.
        transform - Event transformer.
        filter - Optional event filter.
        Returns:
        True if current offset in WAL should be commited.
      • onTypes

        public void onTypes​(Iterator<BinaryType> types)
        Handles new binary types.
        Parameters:
        types - Binary types iterator.
      • onMappings

        public void onMappings​(Iterator<TypeMapping> mappings)
        Handles new mappings.
        Parameters:
        mappings - Mappings iterator.
      • onCacheEvents

        public void onCacheEvents​(Iterator<CdcCacheEvent> cacheEvts)
        Handles new cache events.
        Parameters:
        cacheEvts - Cache events iterator.
      • onCacheDestroyEvents

        public void onCacheDestroyEvents​(Iterator<Integer> caches)
        Handles destroy cache events.
        Parameters:
        caches - Destroyed cache iterator.
      • alive

        public boolean alive()
        Checks that consumer still alive. This method helps to determine CdcConsumer errors in case CdcEvent is rare or source cluster is down.
        Returns:
        True in case consumer alive, false otherwise.
      • consumer

        public CdcConsumer consumer()
        Returns:
        Change Data Capture Consumer.