-
Sub-task
-
Resolution: Done
-
Major
-
None
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