I have a Spring configuration in place for a Redis Pub/Sub similar to the one below...
@Bean@Qualifier("someTopic")public ChannelTopic someTopic() { return new ChannelTopic("someTopic");}@Beanpublic MessageListenerAdapter someMessageListener() { MessageListenerAdapter someMessageListener = new MessageListenerAdapter(SomeMessageSubscriber); return someMessageListener;}@Bean@RefreshScopepublic RedisMessageListenerContainer redisContainer(RedisConnectionFactory connectionFactory) { RedisMessageListenerContainer container = new RedisMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.addMessageListener(someMessageListener(), someTopic()); return container;}
When the @RefreshScope
annotation is included on the RedisMessageListenerContainer
the listeners are not being subscribed to the topic when starting the application. Upon removal of the annotation, everything seems to work as expected.
Any ideas on why the inclusion of this @RefreshScope
annotation would be preventing the subscription of the message listener and how to resolve this issue with the annotation included?