spring-projects / spring-projects/spring-data-redis
RedisMessageListenerContainer does not work with Forwarding LettuceConnectionFactory
Open
@christophstrobl is already working on this.
Since Nov 7, 2022.
status: pending-design-work
status: waiting-for-triage
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
If we use a forwarding RedisConnectionFactory, which does not extends the LettuceConnectionFactory, and delegate the get connection to LettuceConnectionFactory, then the RedisMessageListenerContainer does not work anymore. It works in 2.6.13.
public class RedisConnectionProxyFactory
implements RedisConnectionFactory, ReactiveRedisConnectionFactory {
private final LettuceConnectionFactory innerFactory;
public RedisConnectionProxyFactory(LettuceConnectionFactory factory) {
this.innerFactory = factory;
}
@Override
public RedisConnection getConnection() {
return innerFactory.getConnection();
}
}
It seems caused by this method, the isAsync() is false, so the subscribe is close immediately, and the Container stops working.
private Subscriber createSubscriber(RedisConnectionFactory connectionFactory, Executor executor) {
return ConnectionUtils.isAsync(connectionFactory) ? new Subscriber(connectionFactory)
: new BlockingSubscriber(connectionFactory, executor);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.