fix(client-java): keepalive 30s/10s, close() cancels streams, typed stream errors, malformed-reply checks, lenient TLS for Galaxy client (CJV-001..007, #257)
This commit is contained in:
+28
-1
@@ -79,6 +79,29 @@ only stops the client from waiting; it does not abort an in-flight MXAccess COM
|
||||
call on the worker STA. It is a **single-consumer** surface: drive
|
||||
`hasNext()`/`next()` (or `nextItem()`) from one thread only.
|
||||
|
||||
### Keepalive and closing
|
||||
|
||||
The Netty channel sends an HTTP/2 PING every 30 s, waits 10 s for the
|
||||
acknowledgement, and pings even while no call is active (`keepAliveTime`,
|
||||
`keepAliveTimeout`, `keepAliveWithoutCalls(true)`). A half-open connection
|
||||
(firewall idle-out, host power loss) therefore fails a deadline-less
|
||||
`streamEvents()` reader with an exception within about 40 s instead of blocking
|
||||
forever. Tune them on `MxGatewayClientOptions.builder()` or call
|
||||
`disableKeepAlive()`. Keep `keepAliveTime` at or above the gateway's permitted
|
||||
client ping interval (`MxGateway:*` keepalive policy, 30 s by default); pinging
|
||||
faster makes the gateway send GOAWAY (`too_many_pings`).
|
||||
|
||||
`close()` (and so try-with-resources) calls `shutdownNow()` on a channel the
|
||||
client owns and waits up to 5 s for it to terminate: open streams are cancelled
|
||||
and any thread blocked in `hasNext()` is woken with an exception.
|
||||
`closeAndAwaitTermination()` is the graceful variant that lets in-flight calls
|
||||
finish first (up to the connect timeout) before forcing shutdown.
|
||||
|
||||
A command reply that is `OK` but lacks the expected payload (`register`,
|
||||
`addItem`, `addItem2`, the bulk helpers, `readBulk`, `drainEvents`) throws
|
||||
`MxGatewayMalformedReplyException` instead of returning handle `0` or an empty
|
||||
list.
|
||||
|
||||
### Event buffer, overflow, and interrupts
|
||||
|
||||
The iterator buffers events in a bounded queue whose size is
|
||||
@@ -88,7 +111,11 @@ than `n` events behind, the client cancels the call, keeps the events already
|
||||
buffered, and throws `MxGatewayException` only after you have drained them. Resume
|
||||
with `streamEventsAfter(lastSeenWorkerSequence)`. If the consuming thread is
|
||||
interrupted, the call is cancelled, the interrupt flag is restored, and the
|
||||
iterator throws a `CANCELLED` `StatusRuntimeException`.
|
||||
iterator throws a `CANCELLED` `MxGatewayException` (cause: the
|
||||
`StatusRuntimeException`). Stream failures go through the same typed mapping as
|
||||
unary calls: `PERMISSION_DENIED` becomes `MxGatewayAuthorizationException`,
|
||||
`UNAUTHENTICATED` becomes `MxGatewayAuthenticationException`, and the rest become
|
||||
`MxGatewayException`, with credentials redacted from the description.
|
||||
|
||||
`streamEventsAsync(request, StreamObserver<MxEvent>)` is the non-dropping
|
||||
alternative: it delivers each event to your observer on the gRPC thread with no
|
||||
|
||||
Reference in New Issue
Block a user