Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

@RefreshScope preventing Redis Message Listener from subscribing

$
0
0

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?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>