Top Description Methods
reactor.netty5

public Interface NettyOutbound

extends Publisher<Void>
Known Direct Subinterfaces
reactor.netty5.udp.UdpOutbound
Known Direct Implementers
reactor.netty5.ReactorNetty.OutboundThen, reactor.netty5.channel.ChannelOperations
Imports
java.io.File, .IOException, java.nio.channels.FileChannel, .WritableByteChannel, java.nio.charset.Charset, java.nio.file.Files, .Path, .StandardOpenOption, java.util.Objects, java.util.concurrent.Callable, java.util.function.BiFunction, .Consumer, .Predicate, io.netty5.buffer.Buffer, .BufferAllocator, io.netty5.channel.Channel, .DefaultFileRegion, io.netty5.handler.stream.ChunkedNioFile, org.reactivestreams.Publisher, .Subscriber, reactor.core.Exceptions, reactor.core.publisher.Flux, .Mono

An outbound-traffic API delegating to an underlying Channel.

Note

With HTTP, chaining multiple send operations is discouraged and will not work as expected when send involves scalar or mono publishers. For instance send(flux).send(mono) or send(flux).sendObject(message) will ignore send(flux). This is an anticipation of an API simplification moving forward next versions where send will not return NettyOutbound anymore.

Author
Stephane Maldini

Method Summary

Modifier and TypeMethod and Description
public BufferAllocator

Returns:

the BufferAllocator
alloc
()

Returns the assigned BufferAllocator.

public default Mono<Void>

Returns:

a never completing Mono after this NettyOutbound#then() has completed.
neverComplete
()

Returns a never completing Mono after this NettyOutbound#then() has completed.

public default NettyOutbound

Returns:

A new NettyOutbound to append further send. It will emit a complete signal successful sequence write (e.g. after "flush") or any error during write.
send
(Publisher<? extends Buffer>
the dataStream publishing OUT items to write on this channel
dataStream
)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

public NettyOutbound

Returns:

A new NettyOutbound to append further send. It will emit a complete signal successful sequence write (e.g. after "flush") or any error during write.
send
(Publisher<? extends Buffer>
the dataStream publishing OUT items to write on this channel
dataStream
,
Predicate<Buffer>
that returns true if explicit flush operation is needed after that buffer
predicate
)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendByteArray
(Publisher<? extends byte[]>
the dataStream publishing Buffer items to write on this channel
dataStream
)

Sends bytes to the peer, listens for any error on write and closes on terminal signal (complete|error).

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendFile
(Path
the file Path
file
)

Sends content from given Path using java.nio.channels.FileChannel#transferTo(long, long, WritableByteChannel) support.

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendFile
(Path
the file Path
file
,
long
where to start
position
,
long
how much to transfer
count
)

Sends content from the given Path using java.nio.channels.FileChannel#transferTo(long, long, WritableByteChannel) support, if the system supports it, the path resolves to a local file system File, compression and SSL/TLS is not enabled, then transfer will use zero-byte copy to the peer., otherwise chunked read/write will be used.

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendFileChunked
(Path
the file Path
file
,
long
where to start
position
,
long
how much to transfer
count
)

Sends content from given Path using chunked read/write.

public default NettyOutbound

Returns:

A Mono to signal successful sequence write (e.g. after "flush") or any error during write
sendGroups
(Publisher<? extends Publisher<? extends Buffer>>
the dataStream publishing OUT items to write on this channel
dataStreams
)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendObject
(Publisher<?>
the dataStream publishing items to write on this channel or a simple pojo supported by configured Netty handlers
dataStream
)

Sends an object through Netty pipeline.

public NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendObject
(Publisher<?>
the dataStream publishing items to write on this channel or a simple pojo supported by configured Netty handlers
dataStream
,
Predicate<Object>
that returns true if explicit flush operation is needed after that object
predicate
)

Sends an object through Netty pipeline.

public NettyOutbound

Returns:

A Mono to signal successful sequence write (e.g. after "flush") or any error during write
sendObject
(Object
the object to publish
message
)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendString
(Publisher<? extends String>
the dataStream publishing Buffer items to write on this channel
dataStream
)

Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error).

public default NettyOutbound

Returns:

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write
sendString
(Publisher<? extends String>
the dataStream publishing Buffer items to write on this channel
dataStream
,
Charset
the encoding charset
charset
)

Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error).

public <
state type
S
>
NettyOutbound

Returns:

a new NettyOutbound
sendUsing
(Callable<? extends S>
state generator
sourceInput
,
BiFunction<? super Connection, ? super S, ?>
input to send
mappedInput
,
Consumer<? super S>
state cleaner
sourceCleanup
)

Binds a send to a starting/cleanup lifecycle

Note

Nesting any send* method is not supported.

public default void
subscribe(Subscriber<? super Void>
the Subscriber to listen for send sequence completion/failure
s
)

Implements org.reactivestreams.Publisher.subscribe.

Subscribes a Void subscriber to this outbound and trigger all eventual parent outbound send.
public default Mono<Void>

Returns:

a Mono of pending outbound(s) write completion
then
()

Obtains a Mono of pending outbound(s) write completion.

public default NettyOutbound

Returns:

a new NettyOutbound
then
(Publisher<Void>
the Publisher to subscribe to when this pending outbound then() is complete;
other
)

Appends a Publisher task such as a Mono and returns a new NettyOutbound to sequence further send.

public default NettyOutbound

Returns:

a new NettyOutbound that
then
(Publisher<Void>
the Publisher to subscribe to when this pending outbound then() is complete;
other
,
Runnable
a cleanup hook when other has terminated or cancelled
onCleanup
)

Append a Publisher task such as a Mono and return a new NettyOutbound to sequence further send.

public NettyOutbound

Returns:

the Connection
withConnection
(Consumer<? super Connection>
connection callback
withConnection
)

Call the passed callback with a Connection to operate on the underlying Channel state.

Method Detail

allocback to summary
public BufferAllocator alloc()

Returns the assigned BufferAllocator.

Returns:BufferAllocator

the BufferAllocator

neverCompleteback to summary
public default Mono<Void> neverComplete()

Returns a never completing Mono after this NettyOutbound#then() has completed.

Returns:Mono<Void>

a never completing Mono after this NettyOutbound#then() has completed.

sendback to summary
public default NettyOutbound send(Publisher<? extends Buffer> dataStream)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

A new NettyOutbound type (or the same) for typed send sequences.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<? extends Buffer>

the dataStream publishing OUT items to write on this channel

Returns:NettyOutbound

A new NettyOutbound to append further send. It will emit a complete signal successful sequence write (e.g. after "flush") or any error during write.

sendback to summary
public NettyOutbound send(Publisher<? extends Buffer> dataStream, Predicate<Buffer> predicate)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

A new NettyOutbound type (or the same) for typed send sequences.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<? extends Buffer>

the dataStream publishing OUT items to write on this channel

predicate:Predicate<Buffer>

that returns true if explicit flush operation is needed after that buffer

Returns:NettyOutbound

A new NettyOutbound to append further send. It will emit a complete signal successful sequence write (e.g. after "flush") or any error during write.

sendByteArrayback to summary
public default NettyOutbound sendByteArray(Publisher<? extends byte[]> dataStream)

Sends bytes to the peer, listens for any error on write and closes on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<? extends byte[]>

the dataStream publishing Buffer items to write on this channel

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendFileback to summary
public default NettyOutbound sendFile(Path file)

Sends content from given Path using java.nio.channels.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 io.netty5.channel.FileRegion in the outbound io.netty5.channel.ChannelPipeline

Note

Nesting any send* method is not supported.

Parameters
file:Path

the file Path

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendFileback to summary
public default NettyOutbound sendFile(Path file, long position, long count)

Sends content from the given Path using java.nio.channels.FileChannel#transferTo(long, long, WritableByteChannel) support, if the system supports it, the path resolves to a local file system File, compression and SSL/TLS is not enabled, then transfer will use zero-byte copy to the peer., otherwise chunked read/write will be used.

It will listens for any error on write and closes on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.

Note: Nesting any send* method is not supported.

Parameters
file:Path

the file Path

position:long

where to start

count:long

how much to transfer

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendFileChunkedback to summary
public default NettyOutbound sendFileChunked(Path file, long position, long count)

Sends content from given 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

Nesting any send* method is not supported.

Parameters
file:Path

the file Path

position:long

where to start

count:long

how much to transfer

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendGroupsback to summary
public default NettyOutbound sendGroups(Publisher<? extends Publisher<? extends Buffer>> dataStreams)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error). Each individual Publisher completion will flush the underlying IO runtime.

Note

Nesting any send* method is not supported.

Parameters
dataStreams:Publisher<? extends Publisher<? extends Buffer>>

the dataStream publishing OUT items to write on this channel

Returns:NettyOutbound

A Mono to signal successful sequence write (e.g. after "flush") or any error during write

sendObjectback to summary
public default NettyOutbound sendObject(Publisher<?> dataStream)

Sends an object through Netty pipeline. If type of Publisher, sends all signals, flushing on complete by default. Write occur in FIFO sequence.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<?>

the dataStream publishing items to write on this channel or a simple pojo supported by configured Netty handlers

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendObjectback to summary
public NettyOutbound sendObject(Publisher<?> dataStream, Predicate<Object> predicate)

Sends an object through Netty pipeline. If type of Publisher, sends all signals, flushing on complete by default. Write occur in FIFO sequence.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<?>

the dataStream publishing items to write on this channel or a simple pojo supported by configured Netty handlers

predicate:Predicate<Object>

that returns true if explicit flush operation is needed after that object

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendObjectback to summary
public NettyOutbound sendObject(Object message)

Sends data to the peer, listens for any error on write and closes on terminal signal (complete|error).

Note

Nesting any send* method is not supported.

Parameters
message:Object

the object to publish

Returns:NettyOutbound

A Mono to signal successful sequence write (e.g. after "flush") or any error during write

sendStringback to summary
public default NettyOutbound sendString(Publisher<? extends String> dataStream)

Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<? extends String>

the dataStream publishing Buffer items to write on this channel

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendStringback to summary
public default NettyOutbound sendString(Publisher<? extends String> dataStream, Charset charset)

Sends String to the peer, listens for any error on write and closes on terminal signal (complete|error). If more than one publisher is attached (multiple calls to send()) completion occurs after all publishers complete.

Note

Nesting any send* method is not supported.

Parameters
dataStream:Publisher<? extends String>

the dataStream publishing Buffer items to write on this channel

charset:Charset

the encoding charset

Returns:NettyOutbound

A Publisher to signal successful sequence write (e.g. after "flush") or any error during write

sendUsingback to summary
public <S> NettyOutbound sendUsing(Callable<? extends S> sourceInput, BiFunction<? super Connection, ? super S, ?> mappedInput, Consumer<? super S> sourceCleanup)

Binds a send to a starting/cleanup lifecycle

Note

Nesting any send* method is not supported.

Parameters
<S>
state type
sourceInput:Callable<? extends S>

state generator

mappedInput:BiFunction<? super Connection, ? super S, ?>

input to send

sourceCleanup:Consumer<? super S>

state cleaner

Returns:NettyOutbound

a new NettyOutbound

subscribeback to summary
public default void subscribe(Subscriber<? super Void> s)

Implements org.reactivestreams.Publisher.subscribe.

Subscribes a Void subscriber to this outbound and trigger all eventual parent outbound send.

Parameters
s:Subscriber<? super Void>

the Subscriber to listen for send sequence completion/failure

Annotations
@Override
thenback to summary
public default Mono<Void> then()

Obtains a Mono of pending outbound(s) write completion.

Returns:Mono<Void>

a Mono of pending outbound(s) write completion

thenback to summary
public default NettyOutbound then(Publisher<Void> other)

Appends a Publisher task such as a Mono and returns a new NettyOutbound to sequence further send.

Parameters
other:Publisher<Void>

the Publisher to subscribe to when this pending outbound then() is complete;

Returns:NettyOutbound

a new NettyOutbound

thenback to summary
public default NettyOutbound then(Publisher<Void> other, Runnable onCleanup)

Append a Publisher task such as a Mono and return a new NettyOutbound to sequence further send.

Parameters
other:Publisher<Void>

the Publisher to subscribe to when this pending outbound then() is complete;

onCleanup:Runnable

a cleanup hook when other has terminated or cancelled

Returns:NettyOutbound

a new NettyOutbound that

withConnectionback to summary
public NettyOutbound withConnection(Consumer<? super Connection> withConnection)

Call the passed callback with a Connection to operate on the underlying Channel state.

Parameters
withConnection:Consumer<? super Connection>

connection callback

Returns:NettyOutbound

the Connection