【发布时间】:2015-04-16 07:59:15
【问题描述】:
我有一个简单的喷涂场景,但它并没有像我预期的那样工作。
我有一个喷雾服务器,可以将工作分派到不同的模块,然后返回它们的组合响应。
由于我不想限制模块响应,因此我选择了模块的方法返回 ToResponseMarshallable,因为我有需要返回纯字符串的模块。
模块签名可以是:
def moduleProcessing(): ToResponseMarshallable = randomString()
我的“完整”块看起来与此类似:
complete {
val response1 = moduleProcessing()
val response2 = moduleProcessing()
Seq(response1,response2)
}
在前面的例子中,我希望得到:
[{"someRandomString"},{"anotherRandomString"}]
但我得到了:
[{},{}]
当然,如果我返回单个响应或者如果我将 moduleProcessing 返回类型的签名更改为任何 Marshallable 类型,它将按预期传播。
提前感谢您的帮助!
【问题讨论】:
标签: scala collections response marshalling spray