use of io.scalecube.streams.ListeningServerStream in project scalecube by scalecube.
the class ServiceEchoRunner method main.
/**
* Main method.
*/
public static void main(String[] args) throws InterruptedException {
ListeningServerStream listeningServerStream = ListeningServerStream.newListeningServerStream();
listeningServerStream.bindAwait();
listeningServerStream.listenReadSuccess().map(Event::getMessageOrThrow).subscribe(listeningServerStream::send);
Thread.currentThread().join();
}
use of io.scalecube.streams.ListeningServerStream in project scalecube by scalecube.
the class GatewayRunner method main.
/**
* Main method.
*/
public static void main(String[] args) throws Exception {
ClientStream clientStream = ClientStream.newClientStream();
ServerStream serverStream = ServerStream.newServerStream();
serverStream.listenReadSuccess().map(Event::getMessageOrThrow).subscribe(message -> clientStream.send(SERVICE_ADDRESS, message));
clientStream.listenReadSuccess().map(Event::getMessageOrThrow).subscribe(serverStream::send);
GatewaySocketIoServer.onPort(4040, serverStream).start();
GatewayHttpServer.onPort(8080, serverStream).start();
ListeningServerStream listeningServerStream = ListeningServerStream.newListeningServerStream();
listeningServerStream.withListenAddress("127.0.0.1").withPort(5801).bindAwait();
listeningServerStream.listenReadSuccess().map(Event::getMessageOrThrow).subscribe(listeningServerStream::send);
Thread.currentThread().join();
}
Aggregations