-
Sub-task
-
Resolution: Unresolved
-
Major
-
None
-
False
-
-
False
-
-
Context
Debezium has a very specific and established way of instantiating classes internally — it relies heavily on Java's ServiceLoader mechanism. That is:
- It discovers implementations of interfaces (e.g., OffsetBackingStore, CustomConverter, NotificationService) by scanning the classpath for META-INF/services/... files.
- It loads and instantiates these implementations using reflection.
This is perfectly valid in regular JVM environments, but ServiceLoader is not GraalVM-native friendly out of the box:
- It uses reflection and classpath scanning, which need explicit configuration at build time.
- The services must be registered for reflection and reachable from static analysis.
- It breaks some of the core benefits of Quarkus (especially in native mode).
Decision
We will bridge Debezium’s ServiceLoader usage into Quarkus’s ArC CDI container. This means:
- All components discovered through ServiceLoader in classic Debezium will instead be declared and injected as CDI beans in the Quarkus extension.
- During build time, we will scan and register the known services Debezium requires (e.g., custom converters, notification handlers, offset stores).
- At runtime, when Debezium tries to load a service using ServiceLoader, the Quarkus extension will intercept and provide the corresponding CDI-managed bean.
This provides a seamless and native-compatible integration path.
Consequences
- We will have to mirror some of Debezium's internal interfaces and service points, and rebind them to CDI. This includes:
-
- Custom converters
-
- Lifecycle hooks
-
- Notification handlers
-
- Offset storage
-
- Schema change listeners
-
- Post-processors
- This may require custom glue code to wire CDI beans into Debezium's engine at the right time.
- Some parts of Debezium’s ServiceRegistry might need to be adapted or wrapped to use Quarkus-provided services instead.
- We'll need native image hints (reflect-config.json, resource-config.json, or @RegisterForReflection) for edge cases, although much of this can be handled by Quarkus extensions automatically.
- We'll need to write tests to validate this behavior in both JVM mode and native mode.
References
Debezium Design Document: https://github.com/debezium/debezium-design-documents/pull/16