Package io.bytestreams.exchange.core
Class MultiplexedChannel<REQ,RESP>
java.lang.Object
io.bytestreams.exchange.core.AbstractChannel<REQ,RESP>
io.bytestreams.exchange.core.MultiplexedChannel<REQ,RESP>
- Type Parameters:
REQ- the request message typeRESP- the response message type
- All Implemented Interfaces:
Channel,ClientChannel<REQ,RESP>
- Direct Known Subclasses:
SymmetricChannel
A
ClientChannel backed by a Transport using ID-based (multiplexed) correlation.
Responses are matched to requests by message ID, allowing out-of-order completion. Supports
bounded concurrency (backpressure). Uncorrelated responses are dispatched to the UnhandledMessageHandler, which subclasses may override via onUncorrelatedMessage(Object).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ErrorHandler<REQ, RESP> protected final io.opentelemetry.api.trace.Tracerprotected final ObjectFields inherited from class io.bytestreams.exchange.core.AbstractChannel
channelSpan, closeFuture, DEFAULT_ERROR_BACKOFF_NANOS, defaultTimeout, meterAttributes, readFuture, requestActive, requestDuration, requestErrors, requestTotal, SHUTTING_DOWN, status, transport, writeQueue, writeQueueSize -
Method Summary
Modifier and TypeMethodDescriptionstatic <REQ,RESP>
MultiplexedChannel.Builder<REQ, RESP> builder()protected booleanprotected voidprotected voidonUncorrelatedMessage(RESP response) Called when the read loop receives a response that cannot be correlated to any pending request.Sends a message using the channel's configured default timeout and returns a future that completes when a correlated response arrives.Sends a message with a per-request timeout override.Methods inherited from class io.bytestreams.exchange.core.AbstractChannel
buildMessageAttributes, close, closeFuture, id, interruptIfDrained, start, status
-
Field Details
-
tracer
protected final io.opentelemetry.api.trace.Tracer tracer -
writeLock
-
errorHandler
-
-
Method Details
-
builder
-
onInbound
- Specified by:
onInboundin classAbstractChannel<REQ,RESP>
-
hasPending
protected boolean hasPending()- Specified by:
hasPendingin classAbstractChannel<REQ,RESP>
-
request
Description copied from interface:ClientChannelSends a message using the channel's configured default timeout and returns a future that completes when a correlated response arrives.- Specified by:
requestin interfaceClientChannel<REQ,RESP> - Parameters:
request- the message to send- Returns:
- a future that completes with the correlated response
-
request
Description copied from interface:ClientChannelSends a message with a per-request timeout override.- Specified by:
requestin interfaceClientChannel<REQ,RESP> - Parameters:
request- the message to sendtimeout- the timeout for this request; must be positive- Returns:
- a future that completes with the correlated response
-