Search in sources :

Example 1 with MyServiceInterface

use of service.common.MyServiceInterface in project kontraktor by RuedigerMoeller.

the class MyServiceServerImpl method main.

public static void main(String[] a) {
    // give large queue to service
    MyServiceInterface myService = Actors.AsActor(MyServiceServerImpl.class, 128_000);
    new TCPNIOPublisher().facade(myService).port(6789).serType(SerializerType.FSTSer).publish().await();
    System.out.println("server started on " + 6789);
}
Also used : TCPNIOPublisher(org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher) MyServiceInterface(service.common.MyServiceInterface)

Example 2 with MyServiceInterface

use of service.common.MyServiceInterface in project kontraktor by RuedigerMoeller.

the class ServiceClient method run.

public void run() {
    MyServiceInterface service = (MyServiceInterface) new TCPConnectable().actorClass(MyServiceInterface.class).host("localhost").port(6789).connect((connector, error) -> {
        System.out.println("Disconnected from service .. exiting");
        System.exit(0);
    }).await();
    service.addPerson(new Person("Hickory", "Heinz", 13, Sex.MALE));
    service.addPerson(new Person("Blob", "Jim", 13, Sex.MALE));
    service.addPerson(new Person("Gerstenbroich-Huckerbühl", "Mareike", 17, Sex.MALE));
    service.listPersons(null, null, 13, (p, err) -> {
        if (!Actor.isErrorOrComplete(err))
            System.out.println("found: " + p);
        else {
            System.out.println("query finished");
            System.exit(0);
        }
    });
}
Also used : TCPConnectable(org.nustaq.kontraktor.remoting.tcp.TCPConnectable) MyServiceInterface(service.common.MyServiceInterface)

Aggregations

MyServiceInterface (service.common.MyServiceInterface)2 TCPConnectable (org.nustaq.kontraktor.remoting.tcp.TCPConnectable)1 TCPNIOPublisher (org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher)1