public interface NettyOutbound extends Publisher<Void>
| Modifier and Type | Field and Description |
|---|---|
static FileChunkedStrategy<ByteBuf> |
FILE_CHUNKED_STRATEGY_BUFFER |
| Modifier and Type | Method and Description |
|---|---|
default ByteBufAllocator |
alloc()
Return the assigned
ByteBufAllocator. |
NettyContext |
context()
Return a
NettyContext to operate on the underlying
Channel state. |
default NettyOutbound |
context(java.util.function.Consumer<NettyContext> contextCallback)
Immediately call the passed callback with a
NettyContext to operate on the
underlying
Channel state. |
default FileChunkedStrategy<?> |
getFileChunkedStrategy() |
default Mono<Void> |
neverComplete()
|
default NettyOutbound |
onWriteIdle(long idleTimeout,
Runnable onWriteIdle)
Assign a
Runnable to be invoked when writes have become idle for the given
timeout. |
default NettyOutbound |
options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
Provide a new
NettyOutbound scoped configuration for sending. |
default NettyOutbound |
send(Publisher<? extends ByteBuf> dataStream)
Send data to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
default NettyOutbound |
sendByteArray(Publisher<? extends byte[]> dataStream)
Send bytes to the peer, listen for any error on write and close on terminal
signal (complete|error).
|
default NettyOutbound |
sendFile(Path file)
Send content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
default NettyOutbound |
sendFile(Path file,
long position,
long count)
Send content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
default NettyOutbound |
sendFileChunked(Path file,
long position,
long count)
Note: Nesting any send* method is not supported.
|
default NettyOutbound |
sendGroups(Publisher<? extends Publisher<? extends ByteBuf>> dataStreams)
Send data to the peer, listen for any error on write and close on terminal signal
(complete|error).Each individual
Publisher completion will flush
the underlying IO runtime. |
default NettyOutbound |
sendObject(Object msg)
Send data to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
default NettyOutbound |
sendObject(Publisher<?> dataStream)
Send Object to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
default NettyOutbound |
sendString(Publisher<? extends String> dataStream)
Send String to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
default NettyOutbound |
sendString(Publisher<? extends String> dataStream,
Charset charset)
Send String to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
default void |
subscribe(Subscriber<? super Void> s)
Subscribe a
Void subscriber to this outbound and trigger all eventual
parent outbound send. |
default Mono<Void> |
then()
Obtain a
Mono of pending outbound(s) write completion. |
default NettyOutbound |
then(Publisher<Void> other)
Append a
Publisher task such as a Mono and return a new
NettyOutbound to sequence further send. |
static final FileChunkedStrategy<ByteBuf> FILE_CHUNKED_STRATEGY_BUFFER
default ByteBufAllocator alloc()
ByteBufAllocator.ByteBufAllocatorNettyContext context()
NettyContext to operate on the underlying
Channel state.NettyContextdefault NettyOutbound context(java.util.function.Consumer<NettyContext> contextCallback)
NettyContext to operate on the
underlying
Channel state. This allows for chaining outbound API.contextCallback - context callbackNettyContextdefault FileChunkedStrategy<?> getFileChunkedStrategy()
default NettyOutbound onWriteIdle(long idleTimeout, Runnable onWriteIdle)
Runnable to be invoked when writes have become idle for the given
timeout. This replaces any previously set idle callback.idleTimeout - the idle timeoutonWriteIdle - the idle timeout handlerdefault NettyOutbound options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
NettyOutbound scoped configuration for sending. The
NettyPipeline.SendOptions changes will apply to the next written object or
Publisher.configurator - the callback invoked to retrieve send configurationthis instancedefault NettyOutbound send(Publisher<? extends ByteBuf> dataStream)
A new NettyOutbound type (or the same) for typed send
sequences. An implementor can therefore specialize the Outbound after a first after
a prepending data publisher.
Note: Nesting any send* method is not supported.
dataStream - the dataStream publishing OUT items to write on this channelNettyOutbound to append further send. It will emit a complete
signal successful sequence write (e.g. after "flush") or any error during write.default NettyOutbound sendByteArray(Publisher<? extends byte[]> dataStream)
dataStream - the dataStream publishing Buffer items to write on this channeldefault NettyOutbound sendFile(Path file)
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. If the system supports it and the path resolves to a local file
system File then transfer will use zero-byte copy
to the peer.
It will listen for any error on write and close on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.
Note: this will emit FileRegion in the outbound
ChannelPipeline
Note: Nesting any send* method is not supported.
file - the file Pathdefault NettyOutbound sendFile(Path file, long position, long count)
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. If the system supports it and the path resolves to a local file
system File then transfer will use zero-byte copy
to the peer.
It will listen for any error on write and close on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.
Note: this will emit FileRegion in the outbound
ChannelPipeline
Note: Nesting any send* method is not supported.
file - the file Pathposition - where to startcount - how much to transferdefault NettyOutbound sendFileChunked(Path file, long position, long count)
file - the file Pathposition - where to startcount - how much to transferdefault NettyOutbound sendGroups(Publisher<? extends Publisher<? extends ByteBuf>> dataStreams)
Publisher completion will flush
the underlying IO runtime.
Note: Nesting any send* method is not supported.dataStreams - the dataStream publishing OUT items to write on this channelMono to signal successful sequence write (e.g. after "flush") or
any error during writedefault NettyOutbound sendObject(Publisher<?> dataStream)
dataStream - the dataStream publishing Buffer items to write on this channeldefault NettyOutbound sendObject(Object msg)
msg - the object to publishMono to signal successful sequence write (e.g. after "flush") or
any error during writedefault NettyOutbound sendString(Publisher<? extends String> dataStream)
dataStream - the dataStream publishing Buffer items to write on this channeldefault NettyOutbound sendString(Publisher<? extends String> dataStream, Charset charset)
dataStream - the dataStream publishing Buffer items to write on this channelcharset - the encoding charsetdefault void subscribe(Subscriber<? super Void> s)
Void subscriber to this outbound and trigger all eventual
parent outbound send.subscribe in interface Publisher<Void>s - the Subscriber to listen for send sequence completion/failuredefault Mono<Void> then()
Mono of pending outbound(s) write completion.Mono of pending outbound(s) write completiondefault NettyOutbound then(Publisher<Void> other)
Publisher task such as a Mono and return a new
NettyOutbound to sequence further send.other - the Publisher to subscribe to when this pending outbound
then() is complete;NettyOutbound that