public class ReassemblyDuplexConnection extends Object implements DuplexConnection
DuplexConnection
implementation that reassembles ByteBuf
s.Disposable.Composite, Disposable.Swap
Constructor and Description |
---|
ReassemblyDuplexConnection(DuplexConnection delegate,
int maxInboundPayloadSize)
Constructor with the underlying delegate to receive frames from.
|
Modifier and Type | Method and Description |
---|---|
ByteBufAllocator |
alloc()
Returns the assigned
ByteBufAllocator . |
static int |
assertInboundPayloadSize(int inboundPayloadSize) |
void |
dispose() |
Mono<Void> |
onClose()
Returns a
Mono that terminates when the instance is terminated by any reason. |
Flux<ByteBuf> |
receive()
Returns a stream of all
Frame s received on this connection. |
Mono<Void> |
send(org.reactivestreams.Publisher<ByteBuf> frames)
Sends the source of Frames on this connection and returns the
Publisher representing
the result of this send. |
Mono<Void> |
sendOne(ByteBuf frame)
Sends a single
Frame on this connection and returns the Publisher representing
the result of this send. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
availability
isDisposed
public ReassemblyDuplexConnection(DuplexConnection delegate, int maxInboundPayloadSize)
public static int assertInboundPayloadSize(int inboundPayloadSize)
public Mono<Void> send(org.reactivestreams.Publisher<ByteBuf> frames)
DuplexConnection
Publisher
representing
the result of this send.
Flow control
The passed Publisher
must
send
in interface DuplexConnection
frames
- Stream of Frame
s to send on the connection.Publisher
that completes when all the frames are written on the connection
successfully and errors when it fails.public Mono<Void> sendOne(ByteBuf frame)
DuplexConnection
Frame
on this connection and returns the Publisher
representing
the result of this send.sendOne
in interface DuplexConnection
frame
- Frame
to send.Publisher
that completes when the frame is written on the connection
successfully and errors when it fails.public Flux<ByteBuf> receive()
DuplexConnection
Frame
s received on this connection.
Completion
Returned Publisher
MUST never emit a completion event (Subscriber.onComplete()
.
Error
Returned Publisher
can error with various transport errors. If the underlying
physical connection is closed by the peer, then the returned stream from here MUST
emit an ClosedChannelException
.
Multiple Subscriptions
Returned Publisher
is not required to support multiple concurrent subscriptions.
RSocket will never have multiple subscriptions to this source. Implementations MUST
emit an IllegalStateException
for subsequent concurrent subscriptions, if they do not
support multiple concurrent subscriptions.
receive
in interface DuplexConnection
Frame
s received.public ByteBufAllocator alloc()
DuplexConnection
ByteBufAllocator
.alloc
in interface DuplexConnection
ByteBufAllocator
public Mono<Void> onClose()
Closeable
Mono
that terminates when the instance is terminated by any reason. Note, in
case of error termination, the cause of error will be propagated as an error signal through
Subscriber.onError(Throwable)
. Otherwise, Subscriber.onComplete()
will be called.public void dispose()
dispose
in interface Disposable