Package io.bytestreams.exchange.core
Class ResilientTransport
java.lang.Object
io.bytestreams.exchange.core.ResilientTransport
- All Implemented Interfaces:
Transport,Closeable,AutoCloseable
A
Transport decorator that automatically reconnects using a TransportFactory when
the underlying transport fails.
Reconnection happens at message boundaries — when inputStream() or outputStream() is called after a failure has been detected. The returned streams are wrapped to
detect I/O failures and set an internal stale flag, which triggers reconnection on the next
stream access.
Stream identity: Unlike the general Transport contract, this implementation may
return different stream instances after a reconnect. This is safe with AbstractChannel,
which re-fetches streams on each loop iteration.
Use builder(TransportFactory) to configure backoff strategy and max attempts.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionio.opentelemetry.api.common.AttributesReturns transport-level OTel attributes (e.g. network type, peer address, peer port).static ResilientTransport.Builderbuilder(TransportFactory factory) voidclose()Returns the input stream for reading inbound messages.Returns the output stream for writing outbound messages.
-
Method Details
-
builder
-
inputStream
Description copied from interface:TransportReturns the input stream for reading inbound messages.- Specified by:
inputStreamin interfaceTransport- Throws:
IOException
-
outputStream
Description copied from interface:TransportReturns the output stream for writing outbound messages.- Specified by:
outputStreamin interfaceTransport- Throws:
IOException
-
attributes
public io.opentelemetry.api.common.Attributes attributes()Description copied from interface:TransportReturns transport-level OTel attributes (e.g. network type, peer address, peer port).- Specified by:
attributesin interfaceTransport
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTransport- Throws:
IOException
-