Skip to content
go-aiePublic

About

Actor framework for Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actorx

English | 中文

Actorx is an actor framework for Go that helps you build stateful components that collaborate through messages.

Components process messages in order, with support for asynchronous tasks, streaming results, and lifecycle management from startup through complete shutdown.

Get started

A counter keeps its count in an object. Send it a message to add a value and receive the new total.

import "github.com/go-aie/actorx"

type Add struct {
    N int
}

//actorx:actor
type Counter struct {
    count int
}

func (c *Counter) Add(_ actorx.Context, msg Add) (int, error) {
    c.count += msg.N
    return c.count, nil
}

Counter holds state, Add defines a message, and a named method handles that message. Create an instance and communicate through its address. Routine error handling is omitted here:

ctx := context.Background()
rt, _ := actorx.NewRuntime(ctx)
defer rt.Close(ctx)

addr, _ := rt.Spawn(&Counter{})
n, _ := addr.Call[int](ctx, Add{N: 5})
fmt.Println(n) // 5

Each actor processes messages in order and updates its state inside its own handlers.

The example uses generated message bindings. See Getting started for project setup, binding generation, and steps to run the complete program.

Learn more

Document Contents
Core concepts Understand actors, messages, addresses, and ownership of state and tasks.
Example guide Start with a counter, then learn asynchronous tasks, streaming, lifecycle, and collaboration.
Runtime reference Look up message handling, cancellation, errors, and capacity limits.
Lifecycle Learn about component initialization, shutdown, and resource cleanup.

See the documentation guide for the full documentation.

Distributed extension

For distributed logical Actors, see Actorx Distributed: NATS messaging, conditional ownership, fixed generations and explicit recovery.

License

MIT

About

Actor framework for Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages