Skip to content

RedisMessageListenerContainer does not work with Forwarding LettuceConnectionFactory #2448

Open
@leeychee

Description

@leeychee

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);
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions