I am trying to use pub/sub impl. on Jedis to get information about master going down, but I am not sure how to subscribe to Sentinel channel.
My publisher class:
public Publisher(Jedis publisherJedis, String channels, String clusterName) {
this.publisherJedis = publisherJedis;
this.channels = channels;
this.clusterName = clusterName;
}
public void start() {
log.info("publishing on channel +odown");
try {
while(true) {
if(JedisPoolFactory.getMasterDown(clusterName)) {
publisherJedis.publish("+odown", "master down, master down");
}
}
} catch(Exception ex) {
log.error("failure with end of stream catching.", ex);
}
}
I have to register my sentinel as a publisher and all I need to do is decode the message every time there's a master failover. How do I then subscribe to sentinel channel?