简体   繁体   中英

Akka message is null

I playing with Akka framework for Java, version 2.3.9 Everything is going fine, but have issue with callback. When I run for callback getSender().tell(null, self());

I get in logs

[akka://system/user/TowerOfDeath:Current:266:ceil:34] Message is null
    akka.actor.InvalidMessageException: Message is null
    at akka.pattern.PromiseActorRef.$bang(AskSupport.scala:266)
    at akka.actor.ActorRef.tell(ActorRef.scala:123)

It's fine, than I can't send null, made small generic message and problem solved. But if that error happens, actor dies. I believe that sometimes possible produce bag, where I will send object, what is now null.

Hot to restore actor in that case?

Thanks for help.

Use Supervision, which allows the parent actor to decide how to deal with failures (bugs) like that:

Here's an example: http://doc.akka.io/docs/akka/2.3.14/java/fault-tolerance.html#Creating_a_Supervisor_Strategy

For more information:

http://doc.akka.io/docs/akka/2.3.14/general/supervision.html http://doc.akka.io/docs/akka/2.3.14/java/fault-tolerance.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM