Skip to content

Why lettuce not support connection heartbeat? #2078

@jaybill-lee

Description

@jaybill-lee

Feature Request

Redis Server has a "timeout" conf, when a connection idle "timeout" seconds, Redis Server will close the connection.

Why lettuce not support a connection heartbeat, such as:

ClientResources resources = ClientResources.builder()
                .nettyCustomizer(new NettyCustomizer() {
                    @Override
                    public void afterChannelInitialized(Channel channel) {
                        channel.pipeline().addLast(new IdleStateHandler(0, 3, 0, TimeUnit.SECONDS));
                        channel.pipeline().addLast(new ChannelDuplexHandler() {
                            @Override
                            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
                                if (evt instanceof IdleStateEvent) {
                                    Command<String, String, String> command = new Command<>(CommandType.PING, new StatusOutput<>(StringCodec.UTF8), null);
                                    if (ctx.channel().isActive()) {
                                        ctx.writeAndFlush(command);
                                    }
                                }
                            }
                        });
                    }
                }).build();

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we dont feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions