🎭
GoAkt
GithubReference
  • 👋Introduction
  • 🏛️Design Principles
  • 🔢Versioning
  • 💡Use Cases
  • 🚀Get Started
  • 📦Binaries and Go versions
  • features
    • Actor System
    • Actor
    • Mailbox
    • Messaging
    • PipeTo
    • Passivation
    • Supervision
    • Behaviors
    • Remoting and APIs
    • TLS
    • Scheduler
    • Stashing
    • Routers
    • Events Stream
    • Coordinated Shutdown
    • Persistence
    • Observability
    • Testkit
    • Cluster
    • Service Discovery
    • Cluster Singleton
    • Cluster Client
  • Cluster PubSub
  • Extensions
  • Dependencies
  • Meta Framework
    • eGo
Powered by GitBook
On this page
  • Overview
  • Get Started

Dependencies

Overview

A Dependency is a pluggable and serialisable interface that can be injected into an Actor to extend its functionality with custom or domain-specific behaviour. It provides a flexible mechanism for augmenting actors with capabilities beyond the core runtime—for example:

  • Event sourcing support

  • Metrics collection

  • External service integrations

  • Custom configuration or logging

Dependencies are serialisable, allowing them to be safely persisted and restored at runtime. This enables seamless recovery and continuity during critical system events such as:

  • Actor redeployment or restart

  • Node failover

  • Cross-node actor migration

All dependencies must be registered with the actor system’s dependency registry. Registration ensures that the system can reconstruct and manage dependencies correctly across the actor’s lifecycle.

By using the Dependency interface, you can build reusable, composable, and runtime-safe extensions for your actor system.

Get Started

  • Implement the Dependency interface:

type Dependency interface {
    Serializable
    // ID returns the unique identifier for the extension.
    //
    // The identifier must:
    //   - Be no more than 255 characters long.
    //   - Start with an alphanumeric character [a-zA-Z0-9].
    //   - Contain only alphanumeric characters, hyphens (-), or underscores (_) thereafter.
    //
    // Identifiers that do not meet these constraints are considered invalid.
    ID() string
}

type Serializable interface {
    encoding.BinaryMarshaler
    encoding.BinaryUnmarshaler
}

PreviousExtensionsNexteGo

Last updated 29 days ago

Register the Dependency during the creation of an Actor using the .

Register the Dependency with the given ActorSystem using the method. This will allow the actor system to magically restore the dependencies of a given actor during cluster topology changes or when creating an actor on a remote host.

SpawnOption
Inject