Spring Boot Redis(cluster sentinel) is this possible to get published message in subscribed client after reconnect?

47 Views Asked by At

I am using Redis(cluster sentinel) for the pub/sub mechanism.

I have an issue with the subscription client when there is the master pod gets down and another becomes master that time someone is publishing the message on the channel and some messages get lost how to recover those messages?

Following is my code

RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration().master("mymaster");
        sentinelConfig.sentinel(host, Integer.parseInt(port));

        return new LettuceConnectionFactory(sentinelConfig, LettuceClientConfiguration.builder().readFrom(ReadFrom.REPLICA_PREFERRED).build());

subscription client.

@Autowired
    private ReactiveRedisOperations<String, String> reactiveRedisTemplate;

reactiveRedisTemplate.listenTo(ChannelTopic.of("some_channel")).subscribe(data -> {});
0

There are 0 best solutions below