如何在 Akka Classic 中向演员的父母发送消息? [英] How to send a message to an actor's parent in Akka Classic?

查看:23
本文介绍了如何在 Akka Classic 中向演员的父母发送消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

actor 向其父级发送消息的方法是什么?

What is the method for an actor to send a message to its parent?

我使用的是 Akka 2.2

I'm using Akka 2.2

推荐答案

您正在寻找

getContext().parent()

它为您提供了父级的 ActorRef,因此您可以这样做

which gives you the ActorRef of the parent, so you can do

getContext().parent().tell(...)

这篇关于如何在 Akka Classic 中向演员的父母发送消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆