我有一个graphdsl,由于某种原因,在执行webSocketClientFlow
的Flow
后,我得到一个空流。 run
未来的错误消息是:
java.util.NoSuchElementException: head of empty stream
该图如下所示:
val loginMessage = Flow[LoginCommand].map(data => {
TextMessage(data.toJsonString())
}).named("Converting Login to Message").log("LoginMessage")
val exasolAnnounce = http
.webSocketClientFlow(WebSocketRequest(socketUrl))
.named("ExasolAnnounceLogin")
.log("SendAnnounce")
val announceResponse = builder.add(Flow[Message].map(data =>
LoginCommand.Response.extract(data)
).named("Building Response").log("AnnouncementResponse"))
import GraphDSL.Implicits._
Source.single(new LoginCommand) ~> loginMessage ~> exasolAnnounce ~> announceResponse
最后的DEBUG
日志是:
[DEBUG] [09/11/2018 09:53:43.328] [TestSystem-akka.actor.default-dispatcher-5] [akka://TestSystem/system/IO-TCP/selectors/$a/0] Connection established to [192.168.56.2:8563]
[DEBUG] [09/11/2018 09:53:43.346] [TestSystem-akka.actor.default-dispatcher-17] [akka.stream.Log(akka://TestSystem/system/StreamSupervisor-0)] [SendAnnounce] Upstream finished.
[DEBUG] [09/11/2018 09:53:43.346] [TestSystem-akka.actor.default-dispatcher-17] [akka.stream.Log(akka://TestSystem/system/StreamSupervisor-0)] [AnnouncementResponse] Upstream finished.
所以在我看来,就像它连接到Websocket但由于某种原因没有提供结果。任何人都可以解决问题所在,或者我如何进一步追踪这个问题?
编辑1:
使用ws://echo.websocket.org进行测试,然后按预期进行流处理。不确定如何进一步调试服务器行为。
发现,我们的防火墙正在关闭连接。