chiradip opened a new pull request, #2245:
URL: https://github.com/apache/iggy/pull/2245
Implement Builder Pattern for IggyClient Configuration
Fixes #2202
Changes
Implemented builder pattern for both blocking and async Java TCP clients
to provide a cleaner, more flexible API for client configuration.
Modified Files:
- IggyTcpClient.java - Added Builder and RetryPolicy inner classes
- AsyncIggyTcpClient.java - Added Builder and RetryPolicy inner classes
Features:
- Fluent builder API with method chaining
- Auto-login when credentials are provided
- Configuration options: host, port, credentials, connection timeout,
request timeout, connection pool size, retry policy
- Default values: localhost:8090
- Input validation for host and port
- Full backward compatibility with existing constructors
Example Usage:
IggyTcpClient client = IggyTcpClient.builder()
.host("localhost")
.port(8090)
.credentials("iggy", "iggy")
.connectionTimeout(Duration.ofSeconds(30))
.requestTimeout(Duration.ofSeconds(10))
.retryPolicy(IggyTcpClient.RetryPolicy.exponentialBackoff())
.build();
Testing
- Added comprehensive test suites: IggyTcpClientBuilderTest (14 tests) and
AsyncIggyTcpClientBuilderTest (16 tests)
- All 30 tests pass against live Iggy server
- Validated builder functionality, auto-login, input validation, and
backward compatibility
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]