{"id":26932475,"url":"https://github.com/khulnasoft/go-actors","last_synced_at":"2025-04-02T08:22:04.792Z","repository":{"id":267183485,"uuid":"900480023","full_name":"khulnasoft/go-actors","owner":"khulnasoft","description":"GoActors – A blazingly fast, lightweight, and highly scalable actor-based concurrency engine written in Golang. ","archived":false,"fork":false,"pushed_at":"2025-03-18T17:43:00.000Z","size":25082,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T17:44:28.792Z","etag":null,"topics":["actor-framework","actor-model","actors","distributed-systems","golang","microservices"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khulnasoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-08T21:42:05.000Z","updated_at":"2025-03-18T17:00:48.000Z","dependencies_parsed_at":"2025-01-08T06:20:47.365Z","dependency_job_id":"4c01ae22-d6f1-4cf6-bcc9-14bdb8706632","html_url":"https://github.com/khulnasoft/go-actors","commit_stats":null,"previous_names":["khulnasoft/goactors","khulnasoft/go-actors"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khulnasoft%2Fgo-actors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khulnasoft%2Fgo-actors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khulnasoft%2Fgo-actors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khulnasoft%2Fgo-actors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khulnasoft","download_url":"https://codeload.github.com/khulnasoft/go-actors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246778046,"owners_count":20832097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actor-framework","actor-model","actors","distributed-systems","golang","microservices"],"created_at":"2025-04-02T08:22:03.971Z","updated_at":"2025-04-02T08:22:04.779Z","avatar_url":"https://github.com/khulnasoft.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Goactors - Blazingly Fast, Low-Latency Actors for Golang\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/khulnasoft/goactors)](https://goreportcard.com/report/github.com/khulnasoft/goactors)\n![Build Status](https://github.com/khulnasoft/goactors/actions/workflows/build.yml/badge.svg?branch=master)\n\nGoactors is an **ultra-fast actor engine** designed for speed and low-latency applications such as game servers, advertising brokers, and trading engines. It can handle **10 million messages in under 1 second**.\n\n---\n\n## 🚀 Features\n\n✅ **Guaranteed message delivery** on actor failure (buffer mechanism)  \n✅ **Fire \u0026 forget, request \u0026 response messaging** supported  \n✅ **High-performance dRPC transport layer**  \n✅ **Optimized protobufs without reflection**  \n✅ **Lightweight and highly customizable**  \n✅ **WASM Compilation:** Supports `GOOS=js` and `GOOS=wasm32`  \n✅ **Cluster support** for distributed, self-discovering actors  \n\n---\n\n## 🔥 Benchmarks\n\n```sh\nmake bench\n```\n\n```\nspawned 10 engines\nspawned 2000 actors per engine\nSend storm starting, will send for 10s using 20 workers\nMessages sent per second 1333665\n..\nMessages sent per second 677231\nConcurrent senders: 20 messages sent 6114914, messages received 6114914 - duration: 10s\nmessages per second: 611491\ndeadletters: 0\n```\n\n---\n\n## 📦 Installation\n\n```sh\ngo get github.com/khulnasoft/goactors/...\n```\n\n\u003e **Note:** Goactors requires **Golang `1.21`**\n\n---\n\n## 🚀 Quickstart\n\n### Hello World Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/khulnasoft/goactors/actor\"\n)\n\ntype message struct {\n\tdata string\n}\n\ntype helloer struct{}\n\nfunc newHelloer() actor.Receiver {\n\treturn \u0026helloer{}\n}\n\nfunc (h *helloer) Receive(ctx *actor.Context) {\n\tswitch msg := ctx.Message().(type) {\n\tcase actor.Initialized:\n\t\tfmt.Println(\"Helloer initialized\")\n\tcase actor.Started:\n\t\tfmt.Println(\"Helloer started\")\n\tcase actor.Stopped:\n\t\tfmt.Println(\"Helloer stopped\")\n\tcase *message:\n\t\tfmt.Println(\"Hello, world!\", msg.data)\n\t}\n}\n\nfunc main() {\n\tengine, _ := actor.NewEngine(actor.NewEngineConfig())\n\tpid := engine.Spawn(newHelloer, \"hello\")\n\tengine.Send(pid, \u0026message{data: \"Hello, Goactors!\"})\n}\n```\n\n📂 **More examples are available in the [examples](examples/) folder.**\n\n---\n\n## 🛠 Spawning Actors\n\n#### Default Configuration\n```go\ne.Spawn(newFoo, \"myactorname\")\n```\n\n#### Passing Arguments to Actor Constructor\n```go\nfunc newCustomNameResponder(name string) actor.Producer {\n\treturn func() actor.Receiver {\n\t\treturn \u0026nameResponder{name}\n\t}\n}\n```\n\n```go\npid := engine.Spawn(newCustomNameResponder(\"Khulnasoft\"), \"name-responder\")\n```\n\n#### Custom Configuration\n```go\ne.Spawn(newFoo, \"myactorname\",\n\tactor.WithMaxRestarts(4),\n\tactor.WithInboxSize(2048),\n)\n```\n\n#### Stateless Function Actors\n```go\ne.SpawnFunc(func(c *actor.Context) {\n\tswitch msg := c.Message().(type) {\n\tcase actor.Started:\n\t\tfmt.Println(\"Actor started\")\n\t}\n}, \"foo\")\n```\n\n---\n\n## 🌍 Remote Actors\n\nGoactors allows actors to communicate over a network using the **Remote** package with **protobuf serialization**.\n\n#### Example Configuration\n```go\nimport \"crypto/tls\"\n\ntlsConfig := \u0026tls.Config{Certificates: []tls.Certificate{cert}}\nconfig := remote.NewConfig().WithTLS(tlsConfig)\nremote := remote.New(\"0.0.0.0:2222\", config)\nengine, _ := actor.NewEngine(actor.NewEngineConfig().WithRemote(remote))\n```\n\n📂 **Check out the [Remote Actor Examples](examples/remote) and [Chat Server](examples/chat) for details.**\n\n---\n\n## 🎯 Event Stream\n\nGoactors provides a **powerful event stream** to handle system events gracefully:\n\n✅ **Monitor crashes, deadletters, and network failures**  \n✅ **Subscribe actors to system events**  \n✅ **Broadcast custom events**  \n\n#### List of Internal Events:\n- `actor.ActorInitializedEvent`\n- `actor.ActorStartedEvent`\n- `actor.ActorStoppedEvent`\n- `actor.DeadLetterEvent`\n- `actor.ActorRestartedEvent`\n- `actor.RemoteUnreachableEvent`\n- `cluster.MemberJoinEvent`\n- `cluster.MemberLeaveEvent`\n- `cluster.ActivationEvent`\n- `cluster.DeactivationEvent`\n\n📂 **See the [Event Stream Example](examples/eventstream-monitor) for usage.**\n\n---\n\n## ⚙️ Customizing the Engine\n\nUse **function options** to customize the Goactors engine:\n```go\nr := remote.New(remote.Config{ListenAddr: \"0.0.0.0:2222\"})\nengine, _ := actor.NewEngine(actor.EngineOptRemote(r))\n```\n\n---\n\n## 🏗 Middleware\n\nExtend actors with **custom middleware** for:\n- **Metrics collection**\n- **Data persistence**\n- **Custom logging**\n\n📂 **Examples available in the [middleware folder](examples/middleware).**\n\n---\n\n## 📝 Logging\n\nGoactors uses **structured logging** via `log/slog`:\n```go\nimport \"log/slog\"\nslog.SetDefaultLogger(myCustomLogger)\n```\n\n---\n\n## ✅ Testing\n```sh\nmake test\n```\n\n---\n\n## 📜 License\n\nGoactors is licensed under the **MIT License**.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhulnasoft%2Fgo-actors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhulnasoft%2Fgo-actors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhulnasoft%2Fgo-actors/lists"}