Package akka.actor
Interface Extension
-
- All Known Subinterfaces:
Clock
,IO.Extension
,RemotingFlightRecorder
,ShardingFlightRecorder
,SnapshotStorage
,StreamRefResolver
- All Known Implementing Classes:
AddressUidExtension
,BoundAddressesExtension
,CircuitBreakersRegistry
,Cluster
,ClusterMetricsExtension
,ClusterSharding
,CoordinatedShutdown
,Discovery
,DistributedData
,DistributedPubSub
,DnsExt
,DurableStateStoreRegistry
,EventsourcedInstrumentationProvider
,ExternalShardAllocation
,InMemStorageExtension
,JacksonObjectMapperProvider
,JFRShardingFlightRecorder
,LeaseProvider
,LeaseProvider
,ManifestInfo
,NoOpRemotingFlightRecorder$
,NoOpShardingFlightRecorder$
,Persistence
,PersistencePluginProxyExtensionImpl
,PersistenceQuery
,PersistenceTestKit.Settings
,RecoveryPermitterInstrumentationProvider
,Serialization
,SnapshotTestKit.Settings
,SystemMaterializer
,Tcp
,Tcp
,TcpExt
,TestConductorExt
,TestKitSettings
,UdpConnectedExt
,UdpExt
public interface Extension
The basic ActorSystem covers all that is needed for locally running actors, using futures and so on. In addition, more features can hook into it and thus become visible to actors et al by registering themselves as extensions. This is accomplished by providing an extension—which is an object implementing this trait—toActorSystem.registerExtension(...)
or by specifying the corresponding option in the configuration passed to ActorSystem, which will then instantiate (without arguments) each FQCN and register the result.The extension itself can be created in any way desired and has full access to the ActorSystem implementation.
This trait is only a marker interface to signify an Akka Extension. This is how an extension is normally constructed.
Scala API:
object MyExt extends ExtensionId[Ext] with ExtensionIdProvider { override def lookup = MyExt override def createExtension(system: ExtendedActorSystem): Ext = new Ext(system) // Java API: retrieve the extension for the given system. override def get(system: ActorSystem): UdpExt = super.get(system) override def get(system: ClassicActorSystemProvider): UdpExt = super.get(system) } class Ext(system: ExtendedActorSystem) extends Extension { ... }
Java API:
public class MyExt extends AbstractExtensionId<MyExtImpl> implements ExtensionIdProvider { public final static MyExt MyExtProvider = new MyExt(); private MyExt() {} public MyExt lookup() { return MyExt.MyExtProvider; } public MyExtImpl createExtension(ExtendedActorSystem system) { return new MyExtImpl(); } } public class MyExtImpl implements Extension { ... }