Ultra-fast, distributed, cross-platform actors. http://proto.actor/
This is the Kotlin repository for Proto Actor.
Other implementations:
./gradlew build
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
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.
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
.
Commits on the master branch are deployed as snapshots to https://oss.jfrog.org/artifactory/oss-snapshot-local/actor/proto/ and can be consumed by adding the following configuration to your gradle file:
repositories {
repositories {
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
}
dependencies {
compile 'actor.proto:proto-actor:0.1.0-SNAPSHOT'
}
Tagged commits e.g. v0.0.1
or 1.0.0-rc.1
are published to bintray and linked to jcenter.
repositories {
jcenter()
}
Many thanks to JetBrains for support!
Also thanks to ej-technologies.com for their Java profiler - JProfiler