You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the parent actor's strategy is 'restart' then the following snippet does not work as expected.
The ReceiveTimeout message is triggered only on first actor creation, but not after actor restarts
@Override
public void preStart() {
getContext().setReceiveTimeout(Duration.create(10, TimeUnit.SECONDS));
}
@Override
public Receive createReceive() {
return receiveBuilder()
.match(ReceiveTimeout.class, m -> processMessage())
.build();
}
private void processMessage() {
getContext().setReceiveTimeout(Duration.Undefined()); // turn off timer
throw new RuntimeException("Test exception");
}
This is tested on latest akka 2.5 and akka 2.6
The text was updated successfully, but these errors were encountered:
Do you have an override of postRestart() in that actor? If so, if it doesn't call super.postRestart() it needs to call preStart() or else a restarted actor will never execute preStart() which would explain no receive timeout being set.
If the parent actor's strategy is 'restart' then the following snippet does not work as expected.
The ReceiveTimeout message is triggered only on first actor creation, but not after actor restarts
This is tested on latest akka 2.5 and akka 2.6
The text was updated successfully, but these errors were encountered: