Scala 中的发布者订阅
我是 scala 新手,我正在研究发布者订阅的用法。我的 Google 技能可能有问题,但我似乎找不到这种用法的示例,可以指定订阅者应该观察哪些事件。
有人有一些例子吗?
谢谢!
I'm new to scala, and I'm looking into the Publisher-Subscribe usage. There might be a problem with my Google skills, but I can't seem to find an example of this usage where I can specify which events should be observed by the subscriber.
Anyone got some examples?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你需要一些非常简单的东西,那么我建议你自己做,它应该不会那么难。但如果您想要更大的东西,那么您可以查看 Eventbus。它是 Java 库,但我也在 Scala 中使用它。
Scala 中的示例实现在 http://jim 中描述-mcbeath.blogspot.com/2009/10/simple-publishsubscribe-example-in.html
If you need something really simple, then I suggest do it your self, it should not be that hard. But if you want something bigger then you can look at Eventbus. It is Java lib, but I am using it with Scala too.
An example implementation in Scala is described in http://jim-mcbeath.blogspot.com/2009/10/simple-publishsubscribe-example-in.html
可以在 http://comments.gmane.org 上找到一个简单的参考示例/gmane.comp.lang.scala.user/63002:
An simple reference example can be found on http://comments.gmane.org/gmane.comp.lang.scala.user/63002 :
您可以在这里找到一个简单的 EventBus 实现。它还执行异步事件处理和计划事件发布。
https://github.com/hipjim/scala-event-bus
You can find a simple EventBus implementation here. It also does async event handling and scheduled event publishing.
https://github.com/hipjim/scala-event-bus