IN- the input connection data type (bytes, object...)
OUT- the output connection data type (bytes, object...)
INBOUND- incoming traffic API such as server request or client response
OUTBOUND- outgoing traffic API such as server response or client request
@FunctionalInterface public interface Connector<IN,OUT,INBOUND extends Inbound<IN>,OUTBOUND extends Outbound<OUT>>
Monowill effectively create a new stateful "client" or "server" socket depending on the implementation. It might also be working on top of a socket pool or connection pool as well, but the state should be safely handled by the pool itself.
Clients or Receivers will onSubscribe when their connection is established. They
will complete when the unique returned closing
Publisher completes itself or if
the connection is remotely terminated. Calling the returned
Mono.subscribe() will terminate the subscription
and underlying connection from the local peer.
Servers or Producers will onSubscribe when their socket is bound locally. They will
never complete as many
Publisher close selectors will be expected. Disposing
Mono will safely call shutdown.
Mono<? extends Disposable> newHandler(java.util.function.BiFunction<? super INBOUND,? super OUTBOUND,? extends Publisher<Void>> ioHandler)
BiFunctionIO handler that will react on a new connected state each time the returned
Monois subscribed. This
Connectorshouldn't assume any state related to the individual created/cleaned resources.
The IO handler will return
Publisher to signal when to terminate the
underlying resource channel.