Search in sources :

Example 1 with ServerStream

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();
}
Also used : ServerStream(io.scalecube.streams.ServerStream)

Example 2 with ServerStream

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();
}
Also used : ListeningServerStream(io.scalecube.streams.ListeningServerStream) ListeningServerStream(io.scalecube.streams.ListeningServerStream) ServerStream(io.scalecube.streams.ServerStream) ClientStream(io.scalecube.streams.ClientStream)

Aggregations

ServerStream (io.scalecube.streams.ServerStream)2 ClientStream (io.scalecube.streams.ClientStream)1 ListeningServerStream (io.scalecube.streams.ListeningServerStream)1