apple / swift-distributed-actors

Peer-to-peer cluster implementation for Swift Distributed Actors
https://apple.github.io/swift-distributed-actors/
Apache License 2.0
587 stars 55 forks source link

Added hook to lifecycle events #1150

Open akbashev opened 5 months ago

akbashev commented 5 months ago

Ability to listen to actors lifecycles in a plugin.

Motivation:

Plugins give an option to extend system with some logic. Problem is sometimes you need to hook into actor's creation/deletion, which currently is impossible. As an example—for actor recovery we need to restore state when it's created and ready for cluster system, which can be done by some potential EventSourcingJournal.

By adding simple hook protocol we can enable this.

Modifications:

akbashev commented 5 months ago

Still not sure about PluginActorLifecycleHook name 😅

ktoso commented 4 months ago

@swift-server-bot test this please

ktoso commented 4 months ago

@swift-server-bot add to allowlist