I developed the kafka consumer application based on Spring Cloud Stream 3.0.3.RELEASE. (SpringBoot 2.3.4.RELEASE)
When I stop this application, I want the consumer to gracefully shut down. Similar Questions
- Stop polling new messages
- Finish their work and Commit the offset to Kafka
- Gracefully shut down application
Does the spring cloud stream default this work? Then is there a related document?
For your information, I am using spring cloud stream kafka as below.
#Message handler
@Component
public class MessageHandler {
@Bean
public Consumer<MyEvent> handleMessage() {
return message -> {...}
}
...
}
#application.yml
spring:
cloud:
stream:
bindings:
handleMessage-in-0:
destination: myevent
group: test-group
consumer:
maxAttempts: 2
concurrency: 10
function:
definition: handleMessage
...