scala - 斯卡拉阿卡 | 如何在集群中使用 allButSelf 属性?
问题描述
基于集群的 Akka 文档,我想向集群中除 我自己之外的所有节点发布一条广泛的消息。目前它也总是向我发送广泛的信息。
val mediator = DistributedPubSub(context.system).mediator
mediator ! Subscribe("content", self) // subscribe to the topic named "content"
mediator ! Publish("content", "msg") // sends the msg out Broad to all nodes including myself
如何准确设置文档属性“allButSelf”?
https://doc.akka.io/docs/akka/current/distributed-pub-sub.html
解决方案
你想做
mediator ! DistributedPubSubMediator.Put(testActor)
mediator ! DistributedPubSubMediator.SendToAll(path, msg, allButSelf=false) // it is false by default
推荐阅读
- variables - 使用 sed 为 korn shell 中的变量内容添加前缀
- javascript - 将 Vue.js JSON 对象值直接插入 Javascript setInterval 函数
- c# - 使用 GOTO 在两种情况之间切换
- reactjs - Flow React:无法创建元素,因为 React.Component [1] 不是 React 组件
- java - Spring 使用 servlet3.1 的 Async-IO
- python - 如何在哨兵while循环中使用PyTest测试输入列表
- c# - 如何避免 linq 查询 C# 中的两个嵌入式循环
- python - 用 scrapy 抓取网页不会返回页面内容
- lua - Lua中的elseif和else if有什么区别?
- r - R:使用不同的子元素(每列的特定行)与 sapply