Extensions
Overview
Extension defines a pluggable interface that can be injected into the ActorSystem to extend its core functionality with custom or domain-specific behaviour.
Extensions provide a powerful mechanism to augment the actor system with capabilities not available out-of-the-box—such as support for event sourcing, metrics, and many more or dependency injection.
Once registered, an Extension becomes accessible from any actor's message context, making it easy to share cross-cutting concerns across the system.
Get Started
- Implement the - Extensioninterface.
- Register the extension when creating the actor system using the - WithExtensionsoption.
Once the above steps completed, you can always access the list of extensions of a given extension whenever handling a message using the following methods of the ReceiveContext 
- Extensions - this returns the list of all extensions registered within the - ActorSystem.
- Extension(extensionID string) - retrieves a specific extension registered in the ActorSystem by its unique ID. 
Example
A good example can be found here.
Last updated