Skip to main content
This page lists the interfaces to implement when extending the framework. Wire implementations via the indicated options.

Discovery provider

Discovery Provider
  • ID: Provider name.
  • Initialize: One-time setup.
  • Register: Register this node with the discovery backend.
  • Deregister: Remove this node on shutdown.
  • DiscoverPeers: Return peer addresses (host:port strings).
  • Close: Release resources.
Create a sub-package under discovery/. Pass the provider to ClusterConfig when creating the actor system. See discovery/selfmanaged for a built-in zero-config provider using UDP broadcast.
A node queries its provider when it boots, and with the default quorum of 1 it does not query it again. A provider must list a node as soon as Register has returned and must not answer from a stale view, or it must return an error while its view may be incomplete. Otherwise nodes that boot at the same moment can form separate clusters that never merge. See Discovery happens at boot.

Mailbox

Mailbox
  • Enqueue: Push a message. Return error when full (bounded mailbox).
  • Dequeue: Fetch the next message. Called only from the processing goroutine.
  • IsEmpty / Len: Query mailbox state.
  • Dispose: Free resources, unblock any waiters.
Create a file in actor/. Pass via WithMailbox(mailbox) as a SpawnOption. Reference unbounded_mailbox.go and unbounded_priority_mailbox.go.

Extension (system-wide)

Extension (system-wide)
ID must be unique, alphanumeric, up to 255 chars. Add domain-specific methods to your concrete type. Pass via WithExtensions(ext) when creating the actor system. Actors access via ctx.Extension(id) and type assertion. See Extensions and Dependencies for usage.

Dependency (per-actor)

Dependency (per-actor)
Dependencies must be serializable for cluster relocation. Pass via WithDependencies(dep) as a SpawnOption, or register with the actor system via system.Inject(dep) after startup. Actors access via ctx.Dependencies() in PreStart, Receive, PostStop. See Extensions and Dependencies for usage.