axactor
Tokio actor runtime with local runtime + optional distributed cluster runtime.
Capabilities
#[actor]/#[msg]macro-based API- user/control mailbox split
- restart policy + restart mailbox policy (
Keep/DrainAndDrop) - link / monitor / trap-exit
- lifecycle stream (
Started,Restarted,Stopped) - keyed
Registrywith idle reaper - distributed cluster:
- shard lease ownership + epoch fencing
- ensure/direct routing
- monitor/demonitor/down protocol
- handshake dedup + auth + protocol negotiation
- control/data plane separation
- overlays:
InMemoryOverlay,TcpOverlay
- ref API split:
LocalRef<M>RemoteRef<C: RefContract>AnyRef<C>/Addr<C>
Install
[]
= "0.2.0"
= { = "1", = ["full"] }
Optional Redis lease backend:
= { = "0.2.0", = ["redis-lease"] }
Local Quick Example
use ;
use Arc;
async
Registry
Registry::get_or_spawn(...) -> Result<R, RegistryError>
use ;
use Arc;
let system = new;
let reg: = new;
let cfg = new;
let c = reg.get_or_spawn.await?;
c.inc?;
# Ok::
Cluster Essentials
Secure mode is default:
allow_insecure_auth = falseauth_tokenmust be set (otherwiseClusterNode::start(...)panics)
use ;
use Arc;
let store = new;
let overlay = new;
let cfg = ClusterConfig ;
let _node = start;
Use TcpOverlay for multi-process transport:
use ;
use Duration;
let overlay = with_keepalive_options;
Ref API Split
LocalRef<M>: local hot path, no network/serialization branch.
let local: LocalRef = my_actor_ref.as_local_ref;
local.try_send?;
RemoteRef<C>: wire-safe contract (RemoteSafe bounds on Tell/Ask/Reply).
use ;
;
AnyRef<C> / Addr<C>: optional location-transparent wrapper.
AnyRef::monitor() is supported.
For local contracts, attach monitor adapter explicitly:
let local = new
.with_monitor_fn;
Production Notes
InMemoryOverlay+MemoryLeaseStoreare for tests/dev.- For production, use TCP overlay + external lease store (Redis/etcd-equivalent).
- Keep
allow_insecure_auth = falseand set shared auth token (or stronger transport auth).
See workspace docs:
License
MIT