All Projects → teivah → Gosiris

teivah / Gosiris

Licence: apache-2.0
An actor framework for Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Gosiris

protoactor-go
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 4,138 (+1763.96%)
Mutual labels:  distributed-systems, actors, actor-model, distributed-computing
nact
nact ⇒ node.js + actors ⇒ your services have never been so µ
Stars: ✭ 1,003 (+351.8%)
Mutual labels:  distributed-systems, actors, actor-model
ripple
Simple shared surface streaming application
Stars: ✭ 17 (-92.34%)
Mutual labels:  distributed-systems, actor-model, distributed-computing
Orleans.clustering.kubernetes
Orleans Membership provider for Kubernetes
Stars: ✭ 140 (-36.94%)
Mutual labels:  actor-model, distributed-systems, distributed-computing
Orbit
Orbit - Virtual actor framework for building distributed systems
Stars: ✭ 1,585 (+613.96%)
Mutual labels:  actor-model, actors, distributed-systems
tutorial
Tutorials to help you build your first Swim app
Stars: ✭ 27 (-87.84%)
Mutual labels:  distributed-systems, actor-model, distributed-computing
gen browser
Transparent bi-directional communication for clients, servers and more
Stars: ✭ 67 (-69.82%)
Mutual labels:  distributed-systems, actors, actor-model
protoactor-python
Proto Actor - Ultra fast distributed actors
Stars: ✭ 78 (-64.86%)
Mutual labels:  actors, actor-model, distributed-computing
reacted
Actor based reactive java framework for microservices in local and distributed environment
Stars: ✭ 17 (-92.34%)
Mutual labels:  distributed-systems, actors, actor-model
realtimemap-dotnet
A showcase for Proto.Actor - an ultra-fast distributed actors solution for Go, C#, and Java/Kotlin.
Stars: ✭ 47 (-78.83%)
Mutual labels:  distributed-systems, actors, distributed-computing
Protoactor Go
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 3,934 (+1672.07%)
Mutual labels:  actor-model, actors, distributed-computing
Thespian
Python Actor concurrency library
Stars: ✭ 220 (-0.9%)
Mutual labels:  actor-model, actors, distributed-systems
Nact
nact ⇒ node.js + actors ⇒ your services have never been so µ
Stars: ✭ 848 (+281.98%)
Mutual labels:  actor-model, actors, distributed-systems
transit
Massively real-time city transit streaming application
Stars: ✭ 20 (-90.99%)
Mutual labels:  distributed-systems, actors, actor-model
Hyperf
🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Stars: ✭ 4,206 (+1794.59%)
Mutual labels:  etcd, amqp, zipkin
Protoactor Dotnet
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 1,070 (+381.98%)
Mutual labels:  actors, distributed-systems, distributed-computing
Scalecube Cluster
ScaleCube Cluster is a lightweight Java VM implementation of SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol. features cluster membership, failure detection, and gossip protocol library.
Stars: ✭ 119 (-46.4%)
Mutual labels:  distributed-systems, distributed-computing
Awesome Parallel Computing
A curated list of awesome parallel computing resources
Stars: ✭ 212 (-4.5%)
Mutual labels:  distributed-systems, distributed-computing
Faust
Python Stream Processing. A Faust fork
Stars: ✭ 124 (-44.14%)
Mutual labels:  kafka, distributed-systems
Wasmcloud
wasmCloud is a universal host runtime for actors built with WebAssembly and capability providers
Stars: ✭ 116 (-47.75%)
Mutual labels:  actor-model, actors

Go Report Card

gosiris is an actor framework for Golang.

Features

  • Manage a hierarchy of actors (each actor has its own: state, behavior, mailbox, child actors)
  • Deploy remote actors accessible though an AMQP broker or Kafka
  • Automated registration and runtime discoverability using etcd registry
  • Zipkin integration
  • Built-in patterns (become/unbecome, send, forward, repeat, child supervision)

Examples

Hello world

package main

import (
	"gosiris/gosiris"
)

func main() {
	//Init a local actor system
	gosiris.InitActorSystem(gosiris.SystemOptions{
		ActorSystemName: "ActorSystem",
	})

	//Create an actor
	parentActor := gosiris.Actor{}
	//Close an actor
	defer parentActor.Close()

	//Create an actor
	childActor := gosiris.Actor{}
	//Close an actor
	defer childActor.Close()
	//Register a reaction to event types ("message" in this case)
	childActor.React("message", func(context gosiris.Context) {
		context.Self.LogInfo(context, "Received %v\n", context.Data)
	})

	//Register an actor to the system
	gosiris.ActorSystem().RegisterActor("parentActor", &parentActor, nil)
	//Register an actor by spawning it
	gosiris.ActorSystem().SpawnActor(&parentActor, "childActor", &childActor, nil)

	//Retrieve actor references
	parentActorRef, _ := gosiris.ActorSystem().ActorOf("parentActor")
	childActorRef, _ := gosiris.ActorSystem().ActorOf("childActor")

	//Send a message from one actor to another (from parentActor to childActor)
	childActorRef.Tell(gosiris.EmptyContext, "message", "Hi! How are you?", parentActorRef)
}
INFO: [childActor] 1988/01/08 01:00:00 Received Hi! How are you?

Distributed actor system example

In the following example, in less than 30 effective lines of code, we will see how to create a distributed actor system implementing a request/reply interaction. An actor will be triggered by AMQP messages while another one will be triggered by Kafka events. Each actor will register itself in an etcd instance and will discover the other actor at runtime. Last but not least, gosiris will also manage the Zipkin integration by automatically managing the spans and forwarding the logs.

package main

import (
	"gosiris/gosiris"
	"time"
)

func main() {
	//Configure a distributed actor system with an etcd registry and a Zipkin integration
	gosiris.InitActorSystem(gosiris.SystemOptions{
		ActorSystemName: "ActorSystem",
		RegistryUrl:     "http://etcd:2379",
		ZipkinOptions: gosiris.ZipkinOptions{
			Url:      "http://zipkin:9411/api/v1/spans",
			Debug:    true,
			HostPort: "0.0.0.0",
			SameSpan: true,
		},
	})
	//Defer the actor system closure
	defer gosiris.CloseActorSystem()

	//Configure actor1
	actor1 := new(gosiris.Actor).React("reply", func(context gosiris.Context) {
		//Because Zipkin is enabled, the log will be also sent to the Zipkin server
		context.Self.LogInfo(context, "Received: %v", context.Data)

	})
	//Defer actor1 closure
	defer actor1.Close()
	//Register a remote actor accessible through AMQP
	gosiris.ActorSystem().RegisterActor("actor1", actor1, new(gosiris.ActorOptions).SetRemote(true).SetRemoteType(gosiris.Amqp).SetUrl("amqp://guest:[email protected]:5672/").SetDestination("actor1"))

	//Configure actor2
	actor2 := new(gosiris.Actor).React("context", func(context gosiris.Context) {
		//Because Zipkin is enabled, the log will be also sent to the Zipkin server
		context.Self.LogInfo(context, "Received: %v", context.Data)
		context.Sender.Tell(context, "reply", "hello back", context.Self)
	})
	//Defer actor2 closure
	defer actor2.Close()
	//Register a remote actor accessible through Kafka
	gosiris.ActorSystem().SpawnActor(actor1, "actor2", actor2, new(gosiris.ActorOptions).SetRemote(true).SetRemoteType(gosiris.Kafka).SetUrl("kafka:9092").SetDestination("actor2"))

	//Retrieve the actor references
	actor1Ref, _ := gosiris.ActorSystem().ActorOf("actor1")
	actor2Ref, _ := gosiris.ActorSystem().ActorOf("actor2")

	//Send a message to the kafkaRef
	actor2Ref.Tell(gosiris.EmptyContext, "context", "hello", actor1Ref)

	time.Sleep(250 * time.Millisecond)
}

INFO: [actor2] 2017/11/11 00:38:24 Received: hello
INFO: [actor1] 2017/11/11 00:38:24 Received: hello back

More Examples

See the examples in actor_test.go.

Environment

First of all, to run the examples you must configure the following hostnames: etcd, amqp, zipkin, and kafka. Then to setup the full environment, you can simply run the Docker Compose.

Troubleshooting

You may experience errors during the tests like the following:

r.EncodeArrayStart undefined (type codec.encDriver has no field or method EncodeArrayStart)

This is a known issue with the etcd client used. The manual workaround (for the time being) is to delete manually the file keys.generated.go generated in /vendor.

Contributing

  • Open an issue if you want a new feature or if you spotted a bug
  • Feel free to propose pull requests

Any contribution is more than welcome! In the meantime, if we want to discuss gosiris you can contact me @teivah.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].