use of org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher in project kontraktor by RuedigerMoeller.
the class HelloActor method main.
public static void main(String[] a) {
HelloActor myService = AsActor(HelloActor.class);
// as websocket service fast serialialized
new WebSocketPublisher().facade(myService).hostName("localhost").urlPath("/hello").port(8080).serType(SerializerType.FSTSer).publish();
// as http long poll service, json encoding
new HttpPublisher().facade(myService).hostName("localhost").urlPath("/hellohttp").port(8080).serType(SerializerType.JsonNoRefPretty).publish();
// as tcp nio service, fast serialized
new TCPNIOPublisher().facade(myService).port(6789).serType(SerializerType.FSTSer).publish().await();
}
use of org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher in project kontraktor by RuedigerMoeller.
the class FSTJsonJSTest method main.
public static void main(String[] a) {
HttpClientConnector.DumpProtocol = true;
File root = new File("../fast-serialization/src/main/web/");
Http4K.get().publishFileSystem("localhost", "/", 8080, root);
JSActor jsa = Actors.AsActor(JSActor.class);
new HttpPublisher(jsa, "localhost", "/jsactor/", 8080).serType(SerializerType.JsonNoRefPretty).publish().await();
JSActor client = (JSActor) new HttpConnectable(JSActor.class, "http://localhost:8080/jsactor").serType(SerializerType.JsonNoRefPretty).connect().await();
System.out.println(client.say("blabla").await());
}
use of org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher in project kontraktor by RuedigerMoeller.
the class RemotingTest method testHttpMany.
@Test
public void testHttpMany() throws Exception {
checkSequenceErrors = false;
RemotingTestService service = Actors.AsActor(RemotingTestService.class, Q_SIZE);
ActorServer publisher = new HttpPublisher(service, "localhost", "/lp", 8082).publish().await();
RemotingTestService client = (RemotingTestService) new HttpConnectable(RemotingTestService.class, "http://localhost:8082/lp").connect().await(9999999);
ExecutorService exec = Executors.newCachedThreadPool();
CountDownLatch latch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
exec.execute(() -> {
try {
runWithClient(client, latch);
} catch (Exception e) {
e.printStackTrace();
}
});
}
latch.await();
// wait for outstanding callbacks
Thread.sleep(2000);
publisher.close();
}
use of org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher 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();
}
use of org.nustaq.kontraktor.remoting.http.undertow.HttpPublisher in project kontraktor by RuedigerMoeller.
the class BldFourK method httpAPI.
public HttpPublisher httpAPI(String urlPath, Actor facade) {
HttpPublisher hp = new HttpPublisher(this, facade, hostName, urlPath, port);
items.add(hp);
return hp;
}
Aggregations