use of io.scalecube.streams.ServerStream in project scalecube by scalecube.
the class GatewayEchoRunner method main.
/**
* Main method.
*/
public static void main(String[] args) throws Exception {
ServerStream serverStream = ServerStream.newServerStream();
serverStream.listenReadSuccess().map(Event::getMessageOrThrow).subscribe(serverStream::send);
GatewaySocketIoServer.onPort(4040, serverStream).start();
GatewayHttpServer.onPort(8080, serverStream).start();
Thread.currentThread().join();
}
use of io.scalecube.streams.ServerStream 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