Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-8902 Debezium Engine Quarkus Extension
  3. DBZ-8966

Debezium Engine Quarkus Extension: Add Support to Custom Converter

XMLWordPrintable

      Context

      Debezium supports custom converters to transform specific column types as they are read from a relational database. 

      To offer the same level of flexibility in a native-friendly and declarative way, the Quarkus extension needs to expose an annotation-based mechanism for defining custom relational column converters.

      Decision

      Introduce a new annotation: @CustomConverter. This annotation allows CDI beans to declare a converter for a specific column typeName. The method must return a ConverterDefinition<SchemaBuilder> object, which describes how to map the source column to a target Kafka Connect schema and how to convert the value.

      import io.debezium.engine.InsertEvent;
      import jakarta.enterprise.context.ApplicationScoped;
      
      @ApplicationScoped
      class RawToStringConverter {
      
          @CustomConverter(filter=CustomFilter.class)
          public ConverterDefinition<SchemaBuilder> bind(RelationalColumn raw) { 
              return new ConverterDefinition<>(SchemaBuilder.string(), Object::toString);
          }
          
      } 

      The extension will scan for all such annotated methods at build time and register them during engine initialization.

      Consequences

      • Annotation scanning and mapping must occur during build time to ensure native compatibility.
      • Only one converter may be registered per column typeName; conflicting converters must result in a build-time error.
      • Reflection metadata for the involved classes must be included for native builds.

      References:

      Debezium Design Document: https://github.com/debezium/debezium-design-documents/pull/16

       

       

              gpanice@redhat.com Giovanni Panice
              rh-ee-gpanice Giovanni Panice (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: