Search in sources :

Example 16 with TCPNIOPublisher

use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.

the class Pong method main.

public static void main(String[] args) {
    Pong pong = AsActor(Pong.class);
    new TCPNIOPublisher().port(9080).serType(SerializerType.FSTSer).facade(pong).publish(x -> Log.Info(Pong.class, "disconnected " + x));
    // we need to initiate ping pong. Assumes Ping is already running
    Ping ping = (Ping) new TCPConnectable().host("localhost").port(9080).actorClass(Ping.class).serType(SerializerType.FSTSer).connect().await();
    ping.receivePong(pong);
}
Also used : TCPConnectable(org.nustaq.kontraktor.remoting.tcp.TCPConnectable) TCPNIOPublisher(org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher)

Example 17 with TCPNIOPublisher

use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.

the class RemotingTest method test.

@Test
public void test() {
    RemotingTA serv = Actors.AsActor(RemotingTA.class);
    // websocket
    WebSocketPublisher pub = new WebSocketPublisher().facade(serv).hostName("0.0.0.0").urlPath("/websocket").port(7777).serType(SerializerType.FSTSer);
    pub.publish().await();
    WebSocketConnectable con = new WebSocketConnectable().actorClass(RemotingTA.class).url("ws://localhost:7777/websocket");
    fromRemote(con);
    // TCP NIO
    new TCPNIOPublisher(serv, 7778).publish().await();
    fromRemote(new TCPConnectable(RemotingTA.class, "localhost", 7778));
    // TCP Sync
    new TCPPublisher(serv, 7780).publish().await();
    fromRemote(new TCPConnectable(RemotingTA.class, "localhost", 7780));
    // Http-Longpoll
    new HttpPublisher(serv, "0.0.0.0", "/httpapi", 7779).publish().await();
    fromRemote(new HttpConnectable(RemotingTA.class, "http://localhost:7779/httpapi"));
}
Also used : HttpConnectable(org.nustaq.kontraktor.remoting.http.HttpConnectable) TCPConnectable(org.nustaq.kontraktor.remoting.tcp.TCPConnectable) WebSocketPublisher(org.nustaq.kontraktor.remoting.http.undertow.WebSocketPublisher) HttpPublisher(org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher) TCPPublisher(org.nustaq.kontraktor.remoting.tcp.TCPPublisher) TCPNIOPublisher(org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher) WebSocketConnectable(org.nustaq.kontraktor.remoting.websockets.WebSocketConnectable) Test(org.junit.Test)

Aggregations

TCPNIOPublisher (org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher)17 Test (org.junit.Test)8 TCPConnectable (org.nustaq.kontraktor.remoting.tcp.TCPConnectable)8 Actors (org.nustaq.kontraktor.Actors)4 Promise (org.nustaq.kontraktor.Promise)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 Actor (org.nustaq.kontraktor.Actor)3 WebSocketPublisher (org.nustaq.kontraktor.remoting.http.undertow.WebSocketPublisher)3 RateMeasure (org.nustaq.kontraktor.util.RateMeasure)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 TimeUnit (java.util.concurrent.TimeUnit)2 Ignore (org.junit.Ignore)2 IPromise (org.nustaq.kontraktor.IPromise)2 KxPublisher (org.nustaq.kontraktor.reactivestreams.KxPublisher)2 KxReactiveStreams (org.nustaq.kontraktor.reactivestreams.KxReactiveStreams)2 HttpPublisher (org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher)2 WebSocketConnectable (org.nustaq.kontraktor.remoting.websockets.WebSocketConnectable)2 TableSpaceActor (org.nustaq.reallive.impl.tablespace.TableSpaceActor)2 JCommander (com.beust.jcommander.JCommander)1 MyEvent (examples.MyEvent)1