Replies: 1 comment 2 replies
-
In your example, is the command handler the supervisor of the outbox relay? If so, then the handler would need to implement handling of the supervision event, and creating the new relay. At which point it would have the new actor reference simply need to store it in its state. If not, then whoever is the supervisor of the outbox relay would need to notify any actors that hold a reference to the relay that is reference has now changed. An ActorRef only lives for the lifetime of a single actor, and does not persist through restarts. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently using the
ractor
library in a Rust project and have encountered a scenario that I'd like to discuss and seek guidance on.Context: I have two primary actors in my application:
CommandHandler
- Responsible for handling commands and persisting events to a database.OutboxRelay
- In charge of relaying events to an external service, such as Redis streams.The
CommandHandler
holds anActorRef
to theOutboxRelay
for communication purposes. Both actors are supervised and configured to restart upon encountering errors.Challenge: My concern arises when the
OutboxRelay
encounters an error and restarts, potentially leading to a change in itsActorRef
. This change can render theActorRef
stored in theCommandHandler
obsolete or invalid, disrupting the communication flow.Questions:
ractor
provide a mechanism to ensure thatActorRef
s remain valid or are automatically updated post actor restart? If so, could you guide me on how to implement this?ractor
?I appreciate any insights or suggestions on how to effectively manage
ActorRef
validity in the face of actor restarts within theractor
framework.Beta Was this translation helpful? Give feedback.
All reactions