Search in sources :

Example 1 with ListeningServerStream

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

Example 2 with ListeningServerStream

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

Aggregations

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