Search in sources :

Example 6 with HttpConnectable

use of org.nustaq.kontraktor.remoting.http.HttpConnectable in project kontraktor by RuedigerMoeller.

the class RemotingTest method runtHttp.

public void runtHttp(Coding coding) throws InterruptedException {
    checkSequenceErrors = true;
    RemotingTestService service = Actors.AsActor(RemotingTestService.class, Q_SIZE);
    ActorServer publisher = new HttpPublisher(service, "localhost", "/lp", 8082).coding(coding).publish().await();
    RemotingTestService client = (RemotingTestService) new HttpConnectable(RemotingTestService.class, "http://localhost:8082/lp").coding(coding).connect().await(9999999);
    CountDownLatch latch = new CountDownLatch(1);
    runWithClient(client, latch);
    latch.await();
    // wait for outstanding callbacks
    Thread.sleep(2000);
    publisher.close();
}
Also used : HttpConnectable(org.nustaq.kontraktor.remoting.http.HttpConnectable) ActorServer(org.nustaq.kontraktor.remoting.base.ActorServer) HttpPublisher(org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 7 with HttpConnectable

use of org.nustaq.kontraktor.remoting.http.HttpConnectable 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

HttpConnectable (org.nustaq.kontraktor.remoting.http.HttpConnectable)7 WebSocketConnectable (org.nustaq.kontraktor.remoting.websockets.WebSocketConnectable)5 HttpPublisher (org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 Test (org.junit.Test)2 ActorServer (org.nustaq.kontraktor.remoting.base.ActorServer)2 ConnectableActor (org.nustaq.kontraktor.remoting.base.ConnectableActor)2 SerializerType (org.nustaq.kontraktor.remoting.encoding.SerializerType)2 TCPConnectable (org.nustaq.kontraktor.remoting.tcp.TCPConnectable)2 MyHttpApp (sample.httpjs.MyHttpApp)2 MyHttpAppSession (sample.httpjs.MyHttpAppSession)2 ArrayList (java.util.ArrayList)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 HttpClientConnector (org.nustaq.kontraktor.remoting.http.HttpClientConnector)1 WebSocketPublisher (org.nustaq.kontraktor.remoting.http.undertow.WebSocketPublisher)1 TCPNIOPublisher (org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher)1 TCPPublisher (org.nustaq.kontraktor.remoting.tcp.TCPPublisher)1