Igor Mamaev
Igor Mamaev

Reputation: 33

Pause Spring Cloud Stream Kafka binder programmatically

I work on Spring Boot application, which uses Spring Cloud Stream for integration with Kafka.

I need to pause receiving messages from Kafka programmatically. I khow about possibility to manage lifecycle of bindings by actuator endpoint (docs). So i can autowire org.springframework.cloud.stream.endpoint.BindingsEndpoint and use it's public methods. But it seems to me little strange...

Is there better way to manage lifecycle of bindings programmatically?

Upvotes: 3

Views: 850

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

That's OK to use that BindingsEndpoint bean in your own code. It's purpose is really to manage a lifecycle for the bindings. There is just a simple bonus with that bean that it is exposed as an actuator endpoint to manage bindings over REST.

Otherwise you would go the way to copy/paste the logic of the BindingsEndpoint...

Upvotes: 2

Related Questions