feat: replace gRPC transport with FIBP binary protocol
Merged
VI
8mo ago+1414+1414+0123456789012345678901234567890123456789-1017-1017-0123456789012345678901234567890123456789
Summary
- Replaces the gRPC/protobuf transport with FIBP (Fila Binary Protocol) over raw TCP/TLS
- Removes all gRPC and protobuf dependencies from
build.gradle(no runtime dependencies remain) - Adds
FibpConnectionβ TCP socket with length-prefixed framing, handshake, correlation-ID multiplexing viaConcurrentHashMap + CompletableFuture, heartbeat scheduler, and optional TLS viaSSLSocket - Adds
FibpCodecβ wire encoding/decoding matchingfila-core/src/fibp/wire.rsexactly (enqueue, consume push batch, ack, nack, error frames) - Keeps the public
FilaClientAPI identical:enqueue,enqueueMany,consume,ack,nack,close,Builderwith all TLS/auth/batch options preserved - Batcher groups messages by queue before sending (one FIBP enqueue frame per queue name, since the frame-level field is per-queue)
RpcException.Codereplacesio.grpc.Status.Code; error classification uses keyword matching on plain-text error payloads (matching the Rust SDK pattern)- AUTH uses raw key bytes in
OP_AUTHframe (no length prefix, matching server protocol) - Consume push frames decoded as batches (
msg_count:u16 | messages...) FibpAdminClientadded to test package with hand-rolled minimal protobuf forCreateQueueRequest(avoids a test protobuf dependency)- Integration tests (
FilaClientTest,BatchClientTest,TlsAuthClientTest) guarded by@EnabledIf("serverAvailable")and skip cleanly when no binary is present; unit tests all pass
Test plan
- All 21 unit tests pass (
./gradlew test) -
spotlessCheckpasses (formatting enforced by Google Java Format) - CI integration tests pass against downloaded
fila-serverbinary - TLS tests: verify
withTls(),withTlsCaCert(),withTlsClientCert()(mTLS) all connect - Auth tests: verify
withApiKey()sends AUTH frame and server accepts/rejects correctly
π€ Generated with Claude Code
Summary by cubic
Replaced the gRPC/protobuf transport with FIBP (Fila Binary Protocol) over raw TCP/TLS while keeping the public FilaClient API the same. This removes all gRPC/protobuf deps, adds a single-socket multiplexed connection with heartbeat and AUTH, and includes stability/validation fixes.
-
New Features
- Added
FibpConnection: framing, handshake, correlation IDs, heartbeat scheduler, optional TLS, and AUTH viaOP_AUTH. - Added
FibpCodec: encode/decode for enqueue, batched consume push, ack/nack, and error frames; validates header count (<=255) andstr16length (<=65535). - Public
FilaClientAPI unchanged; batcher groups messages by queue and sends one enqueue frame per queue;enqueueManyenforces a single target queue. - Replaced gRPC status with
RpcException.Code; errors mapped from server error text. - Robustness: remove pending futures on consume timeout/interrupt; guard push handler exceptions to keep the reader thread alive; map batch timeouts to
UNAVAILABLE; add a fallback catch in the batcher to resolve futures withINTERNALon unexpected exceptions. - Tests use
FibpAdminClientfor queue creation (supports TLS/mTLS); README updated; version bumped to0.3.0.
- Added
-
Migration
- Update dependency to
dev.faisca:fila-client:0.3.0. - Replace any uses of gRPC
Status.CodewithRpcException.Code. build()now opens a connection; tests that constructed clients without a running server should guard or defer client creation.- Consume handlers run on the FIBP reader thread; avoid heavy or blocking work in the callback.
enqueueManyshould target a single queue per call.
- Update dependency to