-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
contextRereshed in KafkaListenerEndPointRegistry is set to true only if received ContextRefreshEvent, but in Spring SmartLifeCycle is triggered before ContextFreshEvent is sended out , so when smartLIfeCycle wants to start the containers, contextRefreshed will always be false, so my question is adding alwaysStartAfterRefresh this way ( #2301 ) will not start the containers even if context refreshed.
using 2.8.7 ,following code's output is still false, while true is expected
public class TestListener {
@KafkaListener(id="id1",topics = {"tp"},groupId = "consumerGroupId",autoStartup = "false")
public void Listen(String info){
System.out.println(info);
}
}
ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args);
KafkaListenerEndpointRegistry registry = (KafkaListenerEndpointRegistry)context.getBean("org.springframework.kafka.config.internalKafkaListenerEndpointRegistry");
MessageListenerContainer id1 = registry.getListenerContainer("id1");
System.out.println(id1.isRunning());