public class NetStreams
extends reactor.rx.Streams
//echo server
NetStreams.tcpServer(1234).pipeline( connection -> connection );
NetStreams.tcpClient(1234).pipeline( connection ->
connection
//Listen for any incoming data on that connection, they will be Buffer an IOStream can easily decode
.nest()
.flatMap(self -> IOStreams.decode(new StringCodec('\n'), self))
.consume(log::info);
//Push anything from the publisher returned, here a simple Reactor Stream. By default a Buffer is expected
return Streams.just(Buffer.wrap("hello\n"));
);
//We can also preconfigure global codecs and other custom client/server parameter with the Function signature:
NetStreams.tcpServer(spec -> spec.codec(kryoCodec).listen(1235)).pipeline( intput -> {
input.consume(log::info);
return Streams.period(1l);
});
//Assigning the same codec to a client and a server greatly improve readability and provide for extended type safety.
NetStreams.tcpClient(spec -> spec.connect("localhost", 1235).codec(kryoCodec)).pipeline( input -> {
input.consume(log::info);
return Streams.just("hello");
});
}
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_BIND_ADDRESS |
static java.lang.Class<? extends HttpClient> |
DEFAULT_HTTP_CLIENT_TYPE |
static java.lang.Class<? extends HttpServer> |
DEFAULT_HTTP_SERVER_TYPE |
static int |
DEFAULT_PORT |
static java.lang.Class<? extends TcpClient> |
DEFAULT_TCP_CLIENT_TYPE |
static java.lang.Class<? extends TcpServer> |
DEFAULT_TCP_SERVER_TYPE |
static java.lang.Class<? extends DatagramServer> |
DEFAULT_UDP_SERVER_TYPE |
| Modifier and Type | Method and Description |
|---|---|
static Spec.IncrementalBackoffReconnect |
backoffReconnect() |
static <E,IN,OUT> E |
delegate(ChannelStream<IN,OUT> channelStream)
Utils to read the ChannelStream underlying channel
|
static <E,IN,OUT> E |
delegate(ChannelStream<IN,OUT> channelStream,
java.lang.Class<E> clazz) |
static HttpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
httpClient() |
static <IN,OUT> HttpClient<IN,OUT> |
httpClient(java.lang.Class<? extends HttpClient> clientFactory,
reactor.fn.Function<? super Spec.HttpClient<IN,OUT>,? extends Spec.HttpClient<IN,OUT>> configuringFunction)
Bind a new HTTP client to the specified connect address and port.
|
static <IN,OUT> HttpClient<IN,OUT> |
httpClient(reactor.fn.Function<? super Spec.HttpClient<IN,OUT>,? extends Spec.HttpClient<IN,OUT>> configuringFunction)
Bind a new HTTP client to the specified connect address and port.
|
static HttpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
httpServer() |
static <IN,OUT> HttpServer<IN,OUT> |
httpServer(java.lang.Class<? extends HttpServer> serverFactory,
reactor.fn.Function<? super Spec.HttpServer<IN,OUT>,? extends Spec.HttpServer<IN,OUT>> configuringFunction) |
static <IN,OUT> HttpServer<IN,OUT> |
httpServer(reactor.fn.Function<? super Spec.HttpServer<IN,OUT>,? extends Spec.HttpServer<IN,OUT>> configuringFunction) |
static <IN,OUT> HttpServer<IN,OUT> |
httpServer(int port) |
static <IN,OUT> HttpServer<IN,OUT> |
httpServer(java.lang.String bindAddress) |
static <IN,OUT> HttpServer<IN,OUT> |
httpServer(java.lang.String bindAddress,
int port) |
static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpClient()
Bind a new TCP client to the localhost on port 12012.
|
static <IN,OUT> TcpClient<IN,OUT> |
tcpClient(java.lang.Class<? extends TcpClient> clientFactory,
reactor.fn.Function<? super Spec.TcpClient<IN,OUT>,? extends Spec.TcpClient<IN,OUT>> configuringFunction)
Bind a new TCP client to the specified connect address and port.
|
static <IN,OUT> TcpClient<IN,OUT> |
tcpClient(reactor.fn.Function<? super Spec.TcpClient<IN,OUT>,? extends Spec.TcpClient<IN,OUT>> configuringFunction)
Bind a new TCP client to the specified connect address and port.
|
static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpClient(int port)
Bind a new TCP client to "loopback" on the the specified port.
|
static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpClient(java.lang.String bindAddress)
Bind a new TCP client to the specified connect address and port 12012.
|
static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpClient(java.lang.String bindAddress,
int port)
Bind a new TCP client to the specified connect address and port.
|
static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpServer()
Bind a new TCP server to "loopback" on port 12012.
|
static <IN,OUT> TcpServer<IN,OUT> |
tcpServer(java.lang.Class<? extends TcpServer> serverFactory,
reactor.fn.Function<? super Spec.TcpServer<IN,OUT>,? extends Spec.TcpServer<IN,OUT>> configuringFunction)
Bind a new TCP server to the specified bind address and port.
|
static <IN,OUT> TcpServer<IN,OUT> |
tcpServer(reactor.fn.Function<? super Spec.TcpServer<IN,OUT>,? extends Spec.TcpServer<IN,OUT>> configuringFunction)
Bind a new TCP server to the specified bind address and port.
|
static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpServer(int port)
Bind a new TCP server to "loopback" on the given port.
|
static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpServer(java.lang.String bindAddress)
Bind a new TCP server to the given bind address on port 12012.
|
static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
tcpServer(java.lang.String bindAddress,
int port)
Bind a new TCP server to the given bind address and port.
|
static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
udpServer()
Bind a new UDP server to the "loopback" address.
|
static <IN,OUT> DatagramServer<IN,OUT> |
udpServer(java.lang.Class<? extends DatagramServer> serverFactory,
reactor.fn.Function<? super Spec.DatagramServer<IN,OUT>,? extends Spec.DatagramServer<IN,OUT>> configuringFunction)
Bind a new UDP server to the specified bind address and port.
|
static <IN,OUT> DatagramServer<IN,OUT> |
udpServer(reactor.fn.Function<? super Spec.DatagramServer<IN,OUT>,? extends Spec.DatagramServer<IN,OUT>> configuringFunction)
Bind a new UDP server to the specified bind address and port.
|
static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
udpServer(int port)
Bind a new UDP server to the "loopback" address and specified port.
|
static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
udpServer(java.lang.String bindAddress)
Bind a new UDP server to the given bind address.
|
static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> |
udpServer(java.lang.String bindAddress,
int port)
Bind a new UDP server to the given bind address and port.
|
await, await, await, await, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, concat, concat, concat, concat, concat, concat, concat, concat, concat, create, defer, empty, fail, from, from, from, from, generate, join, join, join, join, join, join, join, join, join, just, just, just, just, just, just, just, just, merge, merge, merge, merge, merge, merge, merge, merge, merge, on, period, period, period, period, period, period, period, period, range, switchOnNext, switchOnNext, switchOnNext, switchOnNext, timer, timer, timer, timer, wrap, zip, zip, zip, zip, zip, zip, zip, zip, zippublic static final int DEFAULT_PORT
public static final java.lang.String DEFAULT_BIND_ADDRESS
public static final java.lang.Class<? extends TcpServer> DEFAULT_TCP_SERVER_TYPE
public static final java.lang.Class<? extends TcpClient> DEFAULT_TCP_CLIENT_TYPE
public static final java.lang.Class<? extends HttpServer> DEFAULT_HTTP_SERVER_TYPE
public static final java.lang.Class<? extends HttpClient> DEFAULT_HTTP_CLIENT_TYPE
public static final java.lang.Class<? extends DatagramServer> DEFAULT_UDP_SERVER_TYPE
public static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpServer()
TcpServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferpublic static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpServer(int port)
TcpServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferport - the port to listen on loopbackpublic static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpServer(java.lang.String bindAddress)
TcpServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferbindAddress - bind address (e.g. "127.0.0.1") to create the server on the default port 12012public static TcpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpServer(java.lang.String bindAddress, int port)
TcpServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferport - the port to listen on the passed bind addressbindAddress - bind address (e.g. "127.0.0.1") to create the server on the passed portpublic static <IN,OUT> TcpServer<IN,OUT> tcpServer(reactor.fn.Function<? super Spec.TcpServer<IN,OUT>,? extends Spec.TcpServer<IN,OUT>> configuringFunction)
TcpServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.configuringFunction - a function will apply and return a Spec to customize the peerpublic static <IN,OUT> TcpServer<IN,OUT> tcpServer(java.lang.Class<? extends TcpServer> serverFactory, reactor.fn.Function<? super Spec.TcpServer<IN,OUT>,? extends Spec.TcpServer<IN,OUT>> configuringFunction)
TcpServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.serverFactory - the given implementation class for this peerconfiguringFunction - a function will apply and return a Spec to customize the peerpublic static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpClient()
TcpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpClient.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferpublic static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpClient(java.lang.String bindAddress)
TcpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpClient.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferbindAddress - the address to connect to on port 12012public static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpClient(int port)
TcpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpClient.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferport - the port to connect to on "loopback"public static TcpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> tcpClient(java.lang.String bindAddress, int port)
TcpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpClient.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferbindAddress - the address to connect toport - the port to connect topublic static <IN,OUT> TcpClient<IN,OUT> tcpClient(reactor.fn.Function<? super Spec.TcpClient<IN,OUT>,? extends Spec.TcpClient<IN,OUT>> configuringFunction)
TcpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpClient.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.configuringFunction - a function will apply and return a Spec to customize the peerpublic static <IN,OUT> TcpClient<IN,OUT> tcpClient(java.lang.Class<? extends TcpClient> clientFactory, reactor.fn.Function<? super Spec.TcpClient<IN,OUT>,? extends Spec.TcpClient<IN,OUT>> configuringFunction)
TcpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use TcpClient.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.clientFactory - the given implementation class for this peerconfiguringFunction - a function will apply and return a Spec to customize the peerpublic static HttpServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> httpServer()
public static <IN,OUT> HttpServer<IN,OUT> httpServer(java.lang.String bindAddress)
bindAddress - public static <IN,OUT> HttpServer<IN,OUT> httpServer(int port)
port - public static <IN,OUT> HttpServer<IN,OUT> httpServer(java.lang.String bindAddress, int port)
bindAddress - port - public static <IN,OUT> HttpServer<IN,OUT> httpServer(reactor.fn.Function<? super Spec.HttpServer<IN,OUT>,? extends Spec.HttpServer<IN,OUT>> configuringFunction)
IN - OUT - configuringFunction - public static <IN,OUT> HttpServer<IN,OUT> httpServer(java.lang.Class<? extends HttpServer> serverFactory, reactor.fn.Function<? super Spec.HttpServer<IN,OUT>,? extends Spec.HttpServer<IN,OUT>> configuringFunction)
IN - OUT - serverFactory - configuringFunction - public static HttpClient<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> httpClient()
public static <IN,OUT> HttpClient<IN,OUT> httpClient(reactor.fn.Function<? super Spec.HttpClient<IN,OUT>,? extends Spec.HttpClient<IN,OUT>> configuringFunction)
HttpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use HttpClient.pipeline(reactor.fn.Function<reactor.io.net.http.HttpChannel<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.configuringFunction - a function will apply and return a Spec to customize the peerpublic static <IN,OUT> HttpClient<IN,OUT> httpClient(java.lang.Class<? extends HttpClient> clientFactory, reactor.fn.Function<? super Spec.HttpClient<IN,OUT>,? extends Spec.HttpClient<IN,OUT>> configuringFunction)
HttpClient is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when client is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use HttpClient.pipeline(reactor.fn.Function<reactor.io.net.http.HttpChannel<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.clientFactory - the given implementation class for this peerconfiguringFunction - a function will apply and return a Spec to customize the peerpublic static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> udpServer()
DatagramServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use DatagramServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferpublic static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> udpServer(java.lang.String bindAddress)
DatagramServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use DatagramServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferbindAddress - bind address (e.g. "127.0.0.1") to create the server on the passed portpublic static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> udpServer(int port)
DatagramServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use DatagramServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferport - the port to listen on the passed bind addresspublic static DatagramServer<reactor.io.buffer.Buffer,reactor.io.buffer.Buffer> udpServer(java.lang.String bindAddress, int port)
DatagramServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use DatagramServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is Bufferport - the port to listen on the passed bind addressbindAddress - bind address (e.g. "127.0.0.1") to create the server on the passed portpublic static <IN,OUT> DatagramServer<IN,OUT> udpServer(reactor.fn.Function<? super Spec.DatagramServer<IN,OUT>,? extends Spec.DatagramServer<IN,OUT>> configuringFunction)
DatagramServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use DatagramServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.configuringFunction - a function will apply and return a Spec to customize the peerpublic static <IN,OUT> DatagramServer<IN,OUT> udpServer(java.lang.Class<? extends DatagramServer> serverFactory, reactor.fn.Function<? super Spec.DatagramServer<IN,OUT>,? extends Spec.DatagramServer<IN,OUT>> configuringFunction)
DatagramServer is a specific kind of Publisher that will emit:
- onNext ChannelStream to consume data from
- onComplete when server is shutdown
- onError when any exception (more specifically IO exception) occurs
From the emitted Channel, one can decide to add in-channel consumers to read any incoming data.
To reply data on the active connection, Channel.sink(org.reactivestreams.Publisher<? extends OUT>) can subscribe to any passed Publisher.
An alternative is to use DatagramServer.pipeline(reactor.fn.Function<reactor.io.net.ChannelStream<IN, OUT>, ? extends org.reactivestreams.Publisher<? extends OUT>>) to both define the input consumers and the output
producers in a single call;
Note that Stream.getCapacity() will be used to switch on/off a channel in auto-read / flush on write mode.
If the capacity is Long.MAX_Value, write on flush and auto read will apply. Otherwise, data will be flushed every
capacity batch size and read will pause when capacity number of elements have been dispatched.
Emitted channels will run on the same thread they have beem receiving IO events.
Apart from dispatching the write, it is possible to use Stream.dispatchOn(reactor.Environment) to process requests
asynchronously.
By default the type of emitted data or received data is BufferIN - the given input type received by this peer. Any configured codec decoder must match this type.OUT - the given output type received by this peer. Any configured codec encoder must match this type.serverFactory - the given implementation class for this peerconfiguringFunction - a function will apply and return a Spec to customize the peerpublic static <E,IN,OUT> E delegate(ChannelStream<IN,OUT> channelStream)
public static <E,IN,OUT> E delegate(ChannelStream<IN,OUT> channelStream, java.lang.Class<E> clazz)
public static Spec.IncrementalBackoffReconnect backoffReconnect()