-
Sub-task
-
Resolution: Done
-
Major
-
None
-
False
-
-
False
-
-
Context
The Debezium Embedded Engine follows a lifecycle consisting of:
- Initialization – Configuration is prepared and the engine is constructed.
- Startup – Connectors are initialized and event streaming begins.
- Shutdown – The engine is stopped, either gracefully or due to an error.
In the current Debezium API, reacting to these phases requires custom callback implementations passed to the engine via .notifying() or custom CompletionCallback logic. This is not idiomatic in Quarkus, where developers expect annotation-based, CDI-integrated lifecycle hooks.
Additionally, Debezium does not provide native integration with CDI, nor does it expose engine lifecycle events in a structured or declarative way.
Decision
We will introduce a set of CDI-compatible annotations in the Quarkus Debezium extension to allow users to react to the engine's lifecycle phases:
- @DebeziumEngineInit – triggered after configuration is validated and the engine is created.
- @DebeziumEngineStartup – triggered when the engine starts streaming events.
- @DebeziumEngineShutdown – triggered when the engine shuts down; receives a status enum.
These annotations can be placed on CDI-managed beans (e.g., @ApplicationScoped) and will be automatically invoked by the extension at the appropriate phase.
Consequences
- The extension must track and expose the Debezium engine state transitions.
- Native support requires all lifecycle-related classes to be registered for reflection.
- Behavior must be defined when multiple methods are annotated for the same lifecycle event (e.g., invoke all vs. ordered execution).
References:
Debezium Design Document: https://github.com/debezium/debezium-design-documents/pull/16