我尝试使用sockjs和stomp.js ( http://jmesnil.net/stomp-websocket/doc/ )为vert.x stomp服务器编写一个简单的javascript stomp客户端。但是我在服务器端被这个错误困住了:
java.lang.IllegalArgumentException: No enum constant io.vertx.ext.stomp.Frame.Command.GET /eventbus/info HTTP/
1.1
at java.lang.Enum.valueOf(Enum.java:238)
at io.vertx.ext.stomp.Frame$Command.valueOf(Frame.java:86)
at io.vertx.ext.stomp.impl.FrameParser.handleLine(FrameParser.java:95)
at io.vertx.core.parsetools.impl.RecordParserImpl.parseDelimited(RecordParserImpl.java:185)
at io.vertx.core.parsetools.impl.RecordParserImpl.handleParsing(RecordParserImpl.java:159)
at io.vertx.core.parsetools.impl.RecordParserImpl.handle(RecordParserImpl.java:218)
at io.vertx.ext.stomp.impl.FrameParser.handle(FrameParser.java:201)
at io.vertx.core.net.impl.NetSocketImpl.handleDataReceived(NetSocketImpl.java:313)
at io.vertx.core.net.impl.VertxNetHandler.lambda$channelRead$30(VertxNetHandler.java:54)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$18(ContextImpl.java:333)
at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:225)
at io.vertx.core.net.impl.VertxNetHandler.channelRead(VertxNetHandler.java:54)
at io.vertx.core.net.impl.VertxNetHandler.channelRead(VertxNetHandler.java:31)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:124)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at java.lang.Thread.run(Thread.java:745)我知道我的客户端使用GET请求到达服务器,但我不知道如何纠正这个问题。
以下是我的服务器代码:
StompServer server = StompServer.create(vertx)
.handler(StompServerHandler.create(vertx)
.destinationFactory((v, name) -> {
System.out.println(name);
return Destination.queue(vertx, "queue");
}) )
.listen(1234, ar -> {
if (ar.failed()) {
System.out.println("failed to start stomp");
} else {
System.out.println("stomp ok");
}
});我的客户代码是:
socket = new SockJS("http://localhost:1234");
stompClient = Stomp.over(socket);
stompClient.connect("guest", "guest", connectCallback, errorCallback);有人知道如何做到这一点吗?
提前谢谢。
发布于 2016-04-28 15:39:09
我在这里找到了答案:https://github.com/vert-x3/vertx-stomp/issues/10
在这里:https://github.com/vert-x3/vertx-stomp/pull/11
因此,我必须等待vertx的3.3版本,它将支持stompJS。
https://stackoverflow.com/questions/36915953
复制相似问题