Skip to content

Add Option to set Netty ConnectionProvider directly #291

Open
@paul-kraftlauget

Description

@paul-kraftlauget

Feature Request

Please add the possibility to configure Netty's ConnectionProvider directly

Is your feature request related to a problem? Please describe

I have experienced this issue when using the r2dbc-mssql client:

io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection reset by peer

I believe this is the same problem as described on: reactor/reactor-netty#1774
In the comments, configuring the ConnectionProvider in such a way solves this issue (indeed, we had this same problem for WebClient and the suggested ConnectionProvider configuration solved the exceptions occurring in the Netty framework).

Describe the solution you'd like

Add the option to set the ConnectionProvider:

ConnectionProvider provider = ConnectionProvider.builder("fixed")
    .maxConnections(500)
    .maxIdleTime(Duration.ofSeconds(20))
    .maxLifeTime(Duration.ofSeconds(60))
    .pendingAcquireTimeout(Duration.ofSeconds(60))
    .evictInBackground(Duration.ofSeconds(120))
    .build();

ConnectionFactoryOptions options = builder()
    .option(DRIVER, "sqlserver")
    ...
    .connectionProvider(CONNECTION_PROVIDER, connectionProvider)
    .build();

Describe alternatives you've considered

It is very difficult to configure this without being supported due to the package-private and final classes in the library. I have managed to add classes in my project located in the io.r2dbc.mssql package to expose and set the connection provider, but the solution is really quite hacky.

I'll create a PR to add the option.

Teachability, Documentation, Adoption, Migration Strategy

Documentation will be included in the pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions