> kontraktor 3
(Micro-)Service oriented, distributed Actors designed for Java 8
Simpler concurrency
Partition your application into message passing single threaded services. Scale out and distribute as needed at deployment time.
Write once, wire everywhere
TCP, WebSockets, Http-LongPoll or in-process: Message transport and encoding is configurable. No need to change your application code.
JavaScript Interop
Kontraktor brings back simplicity and lightweightness to server side Java.
App Container, XML Hell, Annotation Overflow, Classloader madness, slow turnaround, software bureaucracy
High performance
Expect kontraktor to outperform competition by an order of magnitude for many use cases.

Boilerplate-free, typed Actors

Kontraktor uses plain old methods to implicitely define Actor messages. So no need to define "Message"-Classes. This way Inheritance, Interfaces, Refactoring, Code Completion work same as with Pojo's.

public class HelloActor extends Actor<HelloActor> {

    public IPromise greet( String name ) {
        return new Promise("Hello "+name);
    }

    public static void main(String a[]) {
        HelloActor myService = AsActor(HelloActor.class);
        System.out.println( myService.greet("Kontraktor").await() );
    }
}

You might replace Java's 'multithreading/shared data concurrency' model by 'shared-nothing/message passing of single threaded actors'. However Kontraktor plays well with idiomatic Java multithreading code. Mix both models as they fit your needs.

Pluggable network distribution

Transport and message wire format are pluggable options.

HelloActor myService = AsActor(HelloActor.class);

new WebSocketPublisher()
    .facade(myService)
    .hostName("localhost")
    .urlPath("/hello")
    .port(8080)
    .serType(SerializerType.FSTSer)
    .publish();

Client connecting:

HelloActor myService = (HelloActor)
    new WebSocketConnectable(HelloActor.class ,"http://localhost:8080/hello")
      .serType(SerializerType.FSTSer)
      .connect(null)
      .await();
System.out.println( myService.greet("Kontraktor").await() );

JavaScript Client connecting:

  jsk.connect("ws://localhost:8080/ws","WS")
  .then( function( app, error ) {
    app.ask("greet", "kontraktor")
      .then( function(res,err) {
        console.log("greeting:"+res);
      }
  };

Mess-free Single Page Apps

Kontraktor's Http4k manages javascript library dependency, aggregation and minification dynamically if you wish so. JS4k enables seamless connectivity and object encoding between Java and JavaScript. All this is done in a composable, non-frameworky fashion enabling integration with advanced JavaScript client frameworks and many open source libraries and components.
Due to the non-blocking nature of Actor's, scale to thousands of sessions per thread Node.js alike and beyond.

With Http4k, server push is default.

// create server actor
MyHttpApp app = AsActor(MyHttpApp.class);

Http4K.Build("localhost", 8080)
    .fileRoot( "/", root)
    .httpAPI(  "/api", app)
        .serType(SerializerType.JsonNoRef)
        .setSessionTimeout(30_000)
        .build()
    .websocket("ws", app )
        .serType(SerializerType.JsonNoRef)
        .build()
    .resourcePath( "/dyn" )
        .rootComponent("app")
        .resourcePath(
            "./web",
            "./web/components",
            "./web/lib")
        .devMode(false)
        .build()
    .build();

Performance matters !

Don't risk failure caused by bogus marketing brag. Delivering realistic performance metrics let's engineers properly design & size systems upfront.
Closing the gap between remote and JVM-local messaging ensures your system does not slow down or starts behaving whacky when scaling out.

A faster foundation can be traded against lower development cost.


Transport Throughput tell/sec Throughput ask/sec supported # Clients Use case
None (VM Local) 5-7 million 2-3 million n/a (a lot) simpler concurrency model, system scale down
TCP Blocking 2.2 million 1 million <500 (2 Threads per client) System Interconnect
TCP NIO 1.8 million 0.8 million >10_000 Service Provider, System interconnect
WebSocket 1.8 million 1 million >10_000 System Interconnect, Serve GUI Clients, Service Provider
Http-Long Poll 400_000 250_000 >10_000 Serve GUI + Mobile Clients, Unstable networks
Http-Long Poll JSON 200_000 120_000 >10_000 Serve GUI + Mobile Clients, Unstable networks
"Number of clients" is tested with pushing one message to each client each 2 seconds.

Of course rates go down once larger objects are transmitted (see documentation). These are point to point, end to end, single threaded RPC throughput benchmarks including encoding, decoding, routing to the right actor/callback, so don't confuse with benchmarks of sending plain byte blobs or benchmarks running multiple instances of an app (or even clusters) summing up all messages that have been sent somewhere in parallel ...

Maven

Note that maven.org can lag up to a day after releasing.

Kontraktor Core (Actors + TCP Remoting), requires Java 8, LGPL Licensed

<dependency>
    <groupId>de.ruedigermoeller</groupId>
    <artifactId>kontraktor</artifactId>
    <version>3.22</version>
</dependency>

Kontraktor Http (WebSockets, Http LongPoll, Single Page App + JavaScript interop support), requires Java 8, LGPL Licensed

<dependency>
    <groupId>de.ruedigermoeller</groupId>
    <artifactId>kontraktor-http</artifactId>
    <version>3.22</version>
</dependency>

Kontraktor-Reactive Streams (Implements Reactive Streams Spec 1.0), LGPL Licensed

<dependency>
    <groupId>de.ruedigermoeller</groupId>
    <artifactId>kontraktor-reactive-streams</artifactId>
    <version>3.22</version>
</dependency>

Kontraktor-Bare (Minimalistic standalone Http-LongPoll client [legacy apps, Android] ), requires Java 7, Apache 2.0 Licensed

<dependency>
    <groupId>de.ruedigermoeller</groupId>
    <artifactId>kontraktor-bare</artifactId>
    <version>3.22</version>
</dependency>

js4k.js for node.js Apache 2.0 Licensed

prefer the version in
./kontraktor/modules/kontraktor-http/src/main/javascript/js4k
npm install "js4k"
requires websocket, filereader + some entry code (see example)

Credits

(C) 2012-2015 Ruediger Moeller   Blog
Kontraktor is open source and released under the Lesser Gnu Public License (LGPL)
Support/Contact: oskontraktor@gmail.com.