oscerd commented on code in PR #27507:
URL: https://github.com/apache/camel/pull/27507#discussion_r4228437979
##########
components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/main/java/org/apache/camel/component/debezium/DebeziumConsumer.java:
##########
@@ -115,10 +117,20 @@ Throwable getEngineFailure() {
return engineFailure;
}
+ boolean isEngineReady() {
+ return engineReady;
+ }
+
private DebeziumEngine<ChangeEvent<SourceRecord, SourceRecord>>
createDbzEngine() {
return DebeziumEngine.create(Connect.class)
.using(configuration.createDebeziumConfiguration().asProperties())
.using(this::onEngineCompleted)
+ .using(new DebeziumEngine.ConnectorCallback() {
+ @Override
+ public void pollingStarted() {
+ engineReady = true;
+ }
+ })
Review Comment:
Good catch — applied in `2a9e482`.
I verified `pollingStopped()` is actually part of the contract before
relying on it (`javap` on `debezium-api-3.6.3.Final`): `ConnectorCallback`
declares `connectorStarted`, `connectorStopped`, `taskStarted`, `taskStopped`,
`pollingStarted` and `pollingStopped`, all `default`, so the override is safe.
I also pinned it with an assertion rather than shipping it untested —
`readinessWaitsForPollingAndResetsOnRestart` now asserts
`!consumer.isEngineReady()` after `consumer.stop()`. I confirmed it is a real
pin by temporarily removing the override and re-running:
```
AssertionFailedError: stopping the engine should clear readiness ==>
expected: <false> but was: <true>
```
It fails without the change and passes with it.
_Claude Code on behalf of @oscerd_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]