public interface NettyOutbound extends Publisher<java.lang.Void>
Modifier and Type | Method and Description |
---|---|
io.netty.buffer.ByteBufAllocator |
alloc()
Return the assigned
ByteBufAllocator . |
default Mono<java.lang.Void> |
neverComplete()
|
default NettyOutbound |
options(java.util.function.Consumer<? super NettyPipeline.SendOptions> configurator)
Provide a new
NettyOutbound scoped configuration for sending. |
default NettyOutbound |
send(Publisher<? extends io.netty.buffer.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(java.nio.file.Path file)
Send content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
default NettyOutbound |
sendFile(java.nio.file.Path file,
long position,
long count)
Send content from given
Path using
FileChannel.transferTo(long, long, WritableByteChannel)
support. |
default NettyOutbound |
sendFileChunked(java.nio.file.Path file,
long position,
long count)
Send content from given
Path using chunked read/write. |
default NettyOutbound |
sendGroups(Publisher<? extends Publisher<? extends io.netty.buffer.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. |
NettyOutbound |
sendObject(java.lang.Object message)
Send data to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
NettyOutbound |
sendObject(Publisher<?> dataStream)
Send an object through netty pipeline.
|
default NettyOutbound |
sendString(Publisher<? extends java.lang.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 java.lang.String> dataStream,
java.nio.charset.Charset charset)
Send String to the peer, listen for any error on write and close on terminal signal
(complete|error).
|
<S> NettyOutbound |
sendUsing(java.util.concurrent.Callable<? extends S> sourceInput,
java.util.function.BiFunction<? super Connection,? super S,?> mappedInput,
java.util.function.Consumer<? super S> sourceCleanup)
Bind a send to a starting/cleanup lifecycle
|
default void |
subscribe(Subscriber<? super java.lang.Void> s)
Subscribe a
Void subscriber to this outbound and trigger all eventual
parent outbound send. |
default Mono<java.lang.Void> |
then()
Obtain a
Mono of pending outbound(s) write completion. |
default NettyOutbound |
then(Publisher<java.lang.Void> other)
Append a
Publisher task such as a Mono and return a new
NettyOutbound to sequence further send. |
NettyOutbound |
withConnection(java.util.function.Consumer<? super Connection> withConnection)
Call the passed callback with a
Connection to operate on the underlying
Channel state. |
io.netty.buffer.ByteBufAllocator alloc()
ByteBufAllocator
.ByteBufAllocator
default Mono<java.lang.Void> neverComplete()
default 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 io.netty.buffer.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.
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(java.nio.file.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
file
- the file Pathdefault NettyOutbound sendFile(java.nio.file.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
file
- the file Pathposition
- where to startcount
- how much to transferdefault NettyOutbound sendFileChunked(java.nio.file.Path file, long position, long count)
Path
using chunked read/write. 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
file
- the file Pathposition
- where to startcount
- how much to transferdefault NettyOutbound sendGroups(Publisher<? extends Publisher<? extends io.netty.buffer.ByteBuf>> dataStreams)
Publisher
completion will flush
the underlying IO runtime.dataStreams
- the dataStream publishing OUT items to write on this channelMono
to signal successful sequence write (e.g. after "flush") or
any error during writeNettyOutbound sendObject(Publisher<?> dataStream)
dataStream
- the dataStream publishing items to write on this channel
or a simple pojo supported by configured netty handlersNettyOutbound sendObject(java.lang.Object message)
message
- the object to publishMono
to signal successful sequence write (e.g. after "flush") or
any error during writedefault NettyOutbound sendString(Publisher<? extends java.lang.String> dataStream)
dataStream
- the dataStream publishing Buffer items to write on this channeldefault NettyOutbound sendString(Publisher<? extends java.lang.String> dataStream, java.nio.charset.Charset charset)
dataStream
- the dataStream publishing Buffer items to write on this channelcharset
- the encoding charset<S> NettyOutbound sendUsing(java.util.concurrent.Callable<? extends S> sourceInput, java.util.function.BiFunction<? super Connection,? super S,?> mappedInput, java.util.function.Consumer<? super S> sourceCleanup)
S
- state typesourceInput
- state generatormappedInput
- input to sendsourceCleanup
- state cleanerNettyOutbound
default void subscribe(Subscriber<? super java.lang.Void> s)
Void
subscriber to this outbound and trigger all eventual
parent outbound send.subscribe
in interface Publisher<java.lang.Void>
s
- the Subscriber
to listen for send sequence completion/failuredefault Mono<java.lang.Void> then()
Mono
of pending outbound(s) write completion.Mono
of pending outbound(s) write completiondefault NettyOutbound then(Publisher<java.lang.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
thatNettyOutbound withConnection(java.util.function.Consumer<? super Connection> withConnection)
Connection
to operate on the underlying
Channel
state.withConnection
- connection callbackConnection