Reputation: 12392
We have a Spring Boot java app using Debezium 2.4.0.Final.
We start Debezium thus:
@Component
public class Listener {
private final DebeziumEngine<RecordChangeEvent<SourceRecord>> debeziumEngine;
public Listener(Configuration eventsConnectorConfig) {
this.debeziumEngine = DebeziumEngine.create(ChangeEventFormat.of(Connect.class))
.using(eventsConnectorConfig.asProperties())
.notifying(this::handleChangeEvent)
.build();
}
...
}
When the spring boot app shuts down, how do cleanly shutdown the Debezium connector? I took a look at DebeziumEngine class but couldn't find a method to stop/shut it down.
Thanks a lot!
Upvotes: 0
Views: 112
Reputation: 12392
In your listener class, add a method:
@PreDestroy
private void stop() {
if (debeziumEngine != null) {
debeziumEngine.stop();
}
}
I got this answer from https://groups.google.com/u/2/g/debezium/c/KeheEBDpixI
Upvotes: 0