Skip to content

Conversation

@Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Jan 31, 2025

Changes

close #7492

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed my changes

public Akka.Actor.IActorRef Watch(Akka.Actor.IActorRef subject) { }
public Akka.Actor.IActorRef WatchWith(Akka.Actor.IActorRef subject, object message) { }
}
public sealed class IntentionalActorRestartException : Akka.Actor.AkkaException
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new IntentionalActorRestartException and an IntentionalRestart auto-received message. I hope the naming makes it obvious why these exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misc-serializer support for IntentionalRestart

TestActor.Tell(mess);

// can't relay the Restart back because that will blow up the TestActor
if (mess is not IntentionalRestart)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't reply back with the IntentionalRestart message because it will crash the TestActor.


switch (message)
{
case ActorSelectionMessage selectionMessage:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-organized the switch order for performance reasons - with the most frequent messages appearing first for short-circuiting reasons.

break;
case Identify identify:
HandleIdentity(identify);
case Akka.Actor.IntentionalRestart:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added restart handling here - it just throws an IntentionalActorRestartException

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Arkatufus Arkatufus merged commit 1f5688d into akkadotnet:dev Feb 3, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Akka.Actor / Akka.TestKit: add a built-in means of forcing actors to restart

2 participants