public interface Channel<IN,OUT>
extends org.reactivestreams.Publisher<IN>
NetChannel is a virtual connection that often matches with a Socket or a Channel (e.g. Netty).
Implementations handle interacting inbound (received data) and errors by subscribing to it.
Sending data to outbound, closing and even flushing behavior are effectively replying on that virtual connection.
That can be achieved by sinking 1 or more this#sink(org.reactivestreams.Publisher) that will forward data to outbound.
When all drained Publisher completes, the channel will automatically close.
When an error is met by any of the publisher and is not retried, the channel will also be closed.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Channel.ConsumerSpec
Spec class for assigning multiple event handlers on a channel.
|
| Modifier and Type | Method and Description |
|---|---|
Channel.ConsumerSpec |
on()
Assign event handlers to certain channel lifecycle events.
|
java.net.InetSocketAddress |
remoteAddress()
Get the address of the remote peer.
|
void |
sink(org.reactivestreams.Publisher<? extends OUT> dataStream)
Send data to the peer, listen for any error on write and close on terminal signal (complete|error).
|
java.net.InetSocketAddress remoteAddress()
void sink(org.reactivestreams.Publisher<? extends OUT> dataStream)
dataStream - the dataStream publishing OUT items to write on this channelChannel.ConsumerSpec on()