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

Jedis keyspace notification event for "set" not working

$
0
0

So im trying to implement basic listener for when some value is set on redis, but when i set some value nothing happens and only expiry event gets called.

Subscriber

public class Subscriber {    private static JedisPool pool;    public static void main(String[] args) {        JedisPool pool = new JedisPool("localhost");        Jedis jedis = pool.getResource();        jedis.psubscribe(new SubListener(), "*");    }}

SubListener

public class SubListener extends JedisPubSub {    @Override    public void onPSubscribe(String pattern, int subscribedChannels) {        System.out.println("onPSubscribe "+ pattern +" " + subscribedChannels);    }    @Override    public void onPMessage(String pattern, String channel, String message) {        System.out                .println("onPMessage pattern "+ pattern +" " + channel +" " + message);    }}

Edit: i found out that i had the notify-keyspace-events in config set to Ex. Now i set it to KEA to call on every event but what should i use to only call the event on set


Viewing all articles
Browse latest Browse all 2203

Trending Articles



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