Class DebeziumMessageProducerSpec

All Implemented Interfaces:
DisposableBean, FactoryBean<DebeziumMessageProducer>, InitializingBean, Lifecycle, Phased, SmartLifecycle

public class DebeziumMessageProducerSpec extends MessageProducerSpec<DebeziumMessageProducerSpec,DebeziumMessageProducer>
Since:
6.2
Author:
Christian Tzolov, Artem Bilan
  • Constructor Details

    • DebeziumMessageProducerSpec

      protected DebeziumMessageProducerSpec(io.debezium.engine.DebeziumEngine.Builder<io.debezium.engine.ChangeEvent<byte[],byte[]>> debeziumEngineBuilder)
  • Method Details

    • enableBatch

      public DebeziumMessageProducerSpec enableBatch(boolean enable)
      Enable the ChangeEvent batch mode handling. When enabled the channel adapter will send a List of ChangeEvents as a payload in a single downstream Message. Such a batch payload is not serializable. By default, the batch mode is disabled, e.g. every input ChangeEvent is converted into a single downstream Message.
      Parameters:
      enable - set to true to enable the batch mode. Disabled by default.
      Returns:
      the spec.
    • enableEmptyPayload

      public DebeziumMessageProducerSpec enableEmptyPayload(boolean enabled)
      Enable support for tombstone (aka delete) messages. On a database row delete, Debezium can send a tombstone change event that has the same key as the deleted row and a value of Optional.empty(). This record is a marker for downstream processors. It indicates that log compaction can remove all records that have this key. When the tombstone functionality is enabled in the Debezium connector configuration you should enable the empty payload as well.
      Parameters:
      enabled - set true to enable the empty payload. Disabled by default.
      Returns:
      the spec.
    • taskExecutor

      public DebeziumMessageProducerSpec taskExecutor(TaskExecutor taskExecutor)
      Set a TaskExecutor for the Debezium engine.
      Parameters:
      taskExecutor - the TaskExecutor to use.
      Returns:
      the spec.
    • contentType

      public DebeziumMessageProducerSpec contentType(String contentType)
      Set the outbound message content type. Must be aligned with the SerializationFormat configuration used by the provided DebeziumEngine.
      Parameters:
      contentType - payload content type.
      Returns:
      the spec.
    • headerNames

      public DebeziumMessageProducerSpec headerNames(String... headerNames)
      Comma-separated list of names of ChangeEvent headers to be mapped into outbound Message headers. Debezium's NewRecordStateExtraction 'add.headers' property configures the metadata to be used as ChangeEvent headers.

      You should prefix the names passed to the 'headerNames' with the prefix configured by the Debezium 'add.headers.prefix' property. Later defaults to '__'. For example for 'add.headers=op,name' and 'add.headers.prefix=__' you should use header hames like: '__op', '__name'.

      Parameters:
      headerNames - The values in this list can be a simple patterns to be matched against the header names.
      Returns:
      the spec.
    • headerMapper

      public DebeziumMessageProducerSpec headerMapper(HeaderMapper<List<io.debezium.engine.Header<Object>>> headerMapper)
      Set a HeaderMapper to convert the ChangeEvent headers into Message headers.
      Parameters:
      headerMapper - HeaderMapper implementation to use. Defaults to DefaultDebeziumHeaderMapper.
      Returns:
      the spec.