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

Redis spring data message listener for mykey with generic command filter

$
0
0

I am trying to add a specific pattern for my key in redis spring data listener but its not working. Can anybody help me to advice how can I achieve the listener only for a specific command?Below is my message listener container.

@Beanpublic RedisMessageListenerContainer redisMessageListenerContainer(            RedisConnectionFactory connectionFactory,            MyMessageListener myMessageListener) {        RedisMessageListenerContainer listenerContainer = new RedisMessageListenerContainer();        listenerContainer.setConnectionFactory(connectionFactory);        listenerContainer.addMessageListener(myMessageListener,                   new PatternTopic("__keyspace@*__:SampleProj:Message:*"));             return listenerContainer;        }

The above pattern works fine and I can get all the event messages in my messageListener class. like all events: del, hset etc..Now I need to get the only the hset events for mykey and I follwed the commands as mentioned in https://redis.io/docs/manual/keyspace-notifications/ and couldnt succeed the expectations. Below are the patterns I tried.

new PatternTopic("__keyevent*:hset SampleProj:Message:*")new PatternTopic("__keyevent@*__:hset:SampleProj:Message:*"));new PatternTopic("__keyevent@*__:hset SampleProj:Message:*"));

Even with combined list:

Arrays.asList(new PatternTopic("__keyevent@*__:hset SampleProj:Message:"),new PatternTopic("__keyspace@*__:SampleProj:Message:* hset")));

Viewing all articles
Browse latest Browse all 2204

Trending Articles



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