AhmadHegazy / protoactor-kotlin

Ultra-fast distributed cross-platform actor framework

Home Page:http://proto.actor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Coverage Status

Proto.Actor

Ultra-fast, distributed, cross-platform actors.

Installing

...

Source code

This is the Kotlin repository for Proto Actor.

Other implementations:

How to build

...

Design principles

Minimalistic API - The API should be small and easy to use. Avoid enterprisey containers and configurations.

Build on existing technologies - There are already a lot of great technologies for e.g. networking and clustering. Build on those instead of reinventing them. E.g. gRPC streams for networking, Consul for clustering.

Pass data, not objects - Serialization is an explicit concern - don't try to hide it. Protobuf all the way.

Be fast - Do not trade performance for magic API trickery.

Inprocess Ping-Pong results:

Dispatcher		Elapsed		Msg/sec
300			273		116885925
400			217		147426522
500			150		213037390
600			85		375979638
700			87		364621820
800			83		381552772 <-- 380+ mil msg/sec

Getting started

The best place currently for learning how to use Proto.Actor is the examples. Documentation and guidance is under way, but not yet complete, and can be found on the website.

Hello world

Define a message type:

data class Hello(val who : String)

Define an actor:

class HelloActor : Actor
{
    suspend override fun receive(context : Context)
    {
        val msg = context.message
        when (msg)
        {
            is Hello -> println("Hello " + msg.who)
        }
    }
}

Spawn it and send a message to it:

val props = fromProducer({ HelloActor() })
val pid = spawn(props)
pid.send(Hello("Kotlin"))

You should see the output Hello Kotlin.

Support

Many thanks to JetBrains for support!

Also thanks to ej-technologies.com for their Java profiler - JProfiler

About

Ultra-fast distributed cross-platform actor framework

http://proto.actor

License:Apache License 2.0


Languages

Language:Kotlin 93.8%Language:Java 6.2%