feat: transparent leader hint reconnect on consume
Merged
VI
8mo ago+127+127+012345678901234567890123456789-13-13-01234567890123456789
Summary
- When
consume()receives gRPCUNAVAILABLEwithx-fila-leader-addrtrailing metadata, the SDK transparently creates a new connection to the leader address and retries the consume call once - Stores TLS/auth configuration in the client to build redirect channels with the same security settings
- Max 1 redirect per consume call to prevent infinite loops
Test plan
- Verify compilation passes (
./gradlew compileJava) - Verify existing tests still pass (
./gradlew test) - Manual test with a multi-node cluster: consume on a follower node should redirect to the leader
- Verify UNAVAILABLE errors without
x-fila-leader-addrmetadata are still raised asRpcException
Summary by cubic
Adds transparent leader redirect for consume() when a follower returns gRPC UNAVAILABLE with x-fila-leader-addr. Retries once against the hinted leader, reusing TLS and API key settings.
-
New Features
- On
UNAVAILABLEwithx-fila-leader-addr, reconnects to the leader and resumes the stream once. - Reuses configured TLS (CA, client cert/key) and
ApiKeyInterceptoron the redirected channel; extracts channel-building helpers and makesBuilder.parseHost/parsePortreusable. UNAVAILABLEwithout a leader hint still throws the mappedRpcException;CANCELLEDexits quietly.
- On
-
Bug Fixes
- Validates leader address hints before redirecting (must be
host:port, numeric port 1–65535); invalid hints fail fast. - Applied
spotlessformatting (no behavior change).
- Validates leader address hints before redirecting (must be