Skip to content
Advertisement

How to gracefully shutdown spring-kafka consumer application

i have implemented spring-kafka consumer application.

i wants consumer application graceful shutdown.

the current consumer application is terminated with the Linux command kill -9 pid

i am using @KafkaListener annotation now.

if i quit the Spring boot app, i want to reliably close the consumer, what should i do ?


i’ve been using @Predestory to reliably exit the spring boot app, but i’m not quite sure if this has anything to do with it.

Advertisement

Answer

kill -9 is like the death star

JavaScript

The default kill signal SIGTERM (15)

kill <pid>

Boot will shut down everything gracefully; it registers a shutdown hook, which can’t intercept a kill -9.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement