我需要在 wildfly 9 中通过 websocket 配置 STOMP。到目前为止我做了什么,
- 在遵循互联网上的帮助后,我在standalone-full.xml中添加了连接器/接受器,用于通过websocket配置STOMP。配置如下:
并添加相同的套接字绑定(bind)(端口 61614)。
通过此配置,wildfly 9 启动。但我无法通过 websocket 连接到 STOMP。尝试使用 java websocket 客户端通过 ws://localhost:61614/stomp 进行连接。但无法使用相同的方式连接。我还尝试使用 javascript STOMP 客户端库进行连接。但结果是相同的并且无法使用相同的连接。 (如此处所述,http://jmesnil.net/stomp-websocket/doc/)
在此之后,我尝试在接受器配置上添加 STOMP_WS 协议(protocol):
但是当我以此启动 Wildfly 9 时,会出现错误:“实例化远程接受器 org.hornetq.core.remoting.impl.netty.Netty.NettyAcceptorFactory 时出错:HornetQException[errorType=GENERIC_EXCEPTION message=HQ119085:类路径缺少协议(protocol) STOMP_WS 的协议(protocol)管理器]"
另一件事是当我启动 wildfly 9 时,我在日志中看到以下几行,
10:37:33,866 INFO [org.hornetq.core.server](ServerService 线程池 - 64)HQ221043:添加协议(protocol)支持 CORE 10:37:33,878 INFO [org.hornetq.core.server](ServerService 线程池 - 64)HQ221043:添加协议(protocol)支持 AMQP 10:37:33,881 INFO [org.hornetq.core.server](ServerService 线程池 - 64)HQ221043:添加协议(protocol)支持 STOMP
但我没有看到 STOMP_WS 协议(protocol)的情况相同。
所以我的问题是, 1. 如何在wildfly 9中配置STOMP_WS? 2.如果我只使用netty连接器/接受器配置STOMP,这是否意味着它是基于websocket的STOMP?
我已经在 Wildfly 8,9 和 10 中尝试过所有这些,并且在每个版本中都观察到相同的情况。
非常感谢任何帮助!!
最佳答案
在 Wildfly 9 中更改 Netty jar 后,此问题已得到修复。之前是 netty-all-4.0.26.Final.jar。我用 netty-all-4.0.13.Final.jar 替换了它。现在我可以使用以下配置通过 websocket 连接到 STOMP:
<netty-acceptor name="netty-acceptor" socket-binding="netty">
<param key="protocols" value="STOMP"/>
</netty-acceptor>
注意:我没有使用 STOMP_WS 协议(protocol)。
关于websocket - 在 Wildfly 9 中通过 websocket 配置 STOMP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36685532/