Skip to content

Instantly share code, notes, and snippets.

@jbrisbin
Last active August 29, 2015 14:16
Show Gist options
  • Save jbrisbin/cc6600d3cc63c442ea50 to your computer and use it in GitHub Desktop.
Save jbrisbin/cc6600d3cc63c442ea50 to your computer and use it in GitHub Desktop.
Sketch of Reactive Streams interfaces for Client/Server interaction
interface Channel<IN, OUT> extends Publisher<IN> {
Publisher<Boolean> write(Publisher<? extends OUT> data);
}
interface ClientSocketOptions {
SocketAddress connectAddress();
boolean keepAlive();
boolean reuseAddress();
long rvcbuf();
long sndbuf();
}
interface Client<IN, OUT, CHAN extends Channel<IN, OUT>> {
Publisher<CHAN> connect(ClientSocketOptions opts);
Publisher<CHAN> connect(ClientSocketOptions opts, Publisher<Client<IN, OUT, CHAN>> reconnect);
Publisher<Boolean> close();
<I, O, C extends Channel<I, O>> Client<I, O, C> intercept(Function<CHAN, C> fn);
}
interface Server<IN, OUT, CHAN extends Channel<IN, OUT>> {
Publisher<CHAN> start();
Publisher<CHAN> shutdown();
<I, O, C extends Channel<I, O>> Server<I, O, C> intercept(Function<CHAN, C> fn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment