Skip to content
Advertisement

How to run consumer @StreamListener only after ApplicationReadyEvent method completed?

I have a consumer method with

JavaScript

And I have a method with an event listener

JavaScript

Is it possible to configure @StreamListener to start listening only after @EventListener method is completed?

Advertisement

Answer

According to Spring Cloud Stream docs you could use property spring.cloud.stream.bindings.<bindingName>.consumer.autoStartup=false which will stop BindingService from starting automatically starting consumer binding. Then you can do it yourself whenever you need, e.g. in ApplicationReadyEvent listener.

JavaScript

}

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