PlayFramework-在另一个本地ActorSystem中查找演员 [英] PlayFramework -- Look up actors in another local ActorSystem

查看:154
本文介绍了PlayFramework-在另一个本地ActorSystem中查找演员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个播放应用程序,其中有些演员位于另一个ActorSystem中.我正在尝试从播放应用程序访问该ActorSystem中的演员(基本上我将它们连接到REST API,即在播放应用程序获得POST时向他们发送消息).

I have a play application where some actors are located in another ActorSystem. I'm trying to access the actors in that ActorSystem from the play application (basically I connect them to a REST API, i.e. send them messages when the play app gets a POST).

我正在启动时创建此ActorSystem,并且可以从日志中确认它确实已启动.

I'm creating this ActorSystem at start and I can confirm from the logs that it's indeed starting.

让我们假设一个参与者在这个独立系统中的路径是akka://my-system/user/my-actor.如何向该演员发送消息?

Let's assume the path of an actor in this separate system is akka://my-system/user/my-actor. How do I send a message to that actor?

我尝试过:

Akka.system.actorSelection("akka://my-system/user/my-actor") ! SomeMessage(...)

但这不起作用.在日志中,我可以看到以下错误(启用了deadLetters日志记录):

But this doesn't work. In the logs, I can see the following error (with deadLetters logging enabled):

Message ... from Actor[akka://application/deadLetters] to Actor[akka://application/deadLetters] was not delivered

为什么不起作用?而我该如何运作呢?

Why doesn't it work?? And how can I get it to work?

非常感谢您的帮助!

推荐答案

如果Akka.system是我的系统" actor系统,那么您应该可以跳过"akka://my-system"部分,然后直接访问"/user/my-actor".

If Akka.system is the "my-system" actor system, then you should be able to skip the "akka://my-system" part and go directly for "/user/my-actor".

如果Akka.system是另一个actor系统,则可以使用远程处理并指定另一个系统的完整地址,例如"akka.tcp://my-system @ my-host:my-port/user/我的演员".

If Akka.system is another actor system, then you can use remoting and specify a complete address to the other system, like this "akka.tcp://my-system@my-host:my-port/user/my-actor".

这篇关于PlayFramework-在另一个本地ActorSystem中查找演员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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