non*_*com 5 playframework playframework-2.0 playframework-2.1
在我的Play 2.0.4程序中,我有这段代码:
val channel = Enumerator.imperative[JsValue](onStart = self ! NotifyJoin(username))
Run Code Online (Sandbox Code Playgroud)
现在它说imperative已经弃用了,API说我应该使用unicast或broadcast代替.我倾向于使用,unicast因为在我的代码中channel是单播.所以我喜欢
val channel = Concurrent.unicast[JsValue](onStart = self ! NotifyJoin(username))
Run Code Online (Sandbox Code Playgroud)
但它不起作用..看起来像是unicast想要别的东西.我无法弄清楚 - API中没有更多信息......有谁知道该怎么做?
更新:
在Play Framework用户组中开始讨论.事实证明,对于那些了解范式的开发人员来说,这是一个非常普遍的问题.希望文档能够得到改进.
其APIConcurrent.unicast是:
unicast[E](onStart: (Channel[E]) \xe2\x87\x92 Unit, onComplete: \xe2\x87\x92 Unit, onError: (String, Input[E]) \xe2\x87\x92 Unit): Enumerator[E]\nRun Code Online (Sandbox Code Playgroud)\n\n其APIConcurrent.broadcast是:
broadcast[E]: (Enumerator[E], Channel[E])\nRun Code Online (Sandbox Code Playgroud)\n\n您可以通过以下位置访问应用程序中的 API:
\n\nhttp://localhost:9000/@documentation/api/scala/index.html#play.api.libs.iteratee.Concurrent$\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
593 次 |
| 最近记录: |