【问题标题】:Spring Boot Stomp-Transaction Sockjs: ERROR message=[Bad transaction] Invalid transaction identifierSpring Boot Stomp-Transaction Sockjs: ERROR message=[Bad transaction] Invalid transaction identifier
【发布时间】:2021-11-09 11:15:30
【问题描述】:

我使用 Spring Boot 为 Rabbitmq 实现了 RelayMessageBroker,并按预期工作。我通过 SockJS 使用 JavaScript-Client 来订阅队列并接收/发送消息。

我只是在尝试使用 stomp 事务时遇到问题。

我的 JS 代码:

          var tx = clientRef.client.begin();
          clientRef.client.send("/queue/onnext", {
                                transaction: tx.id,
                                durable:false,
                                exclusive:false,
                                "auto-delete":false
                                }, 'test123');
          tx.commit()

Spring 关闭连接并报错:

o.s.m.s.s.StompBrokerRelayMessageHandler : Received ERROR {message=[Bad transaction], content-type=[text/plain], version=[1.0,1.1,1.2], content-length=[39]} session=wajdofjf, user=test text/plain payload=Invalid transaction identifier: "tx-1"

【问题讨论】:

    标签: spring-boot rabbitmq stomp sockjs


    【解决方案1】:

    我自己找到了解决方案: sockjs 尝试通过连接

    ["CONNECT\naccept-version:1.1,1.0\nheart-beat:10000,10000\n\n\u0000"] -> stomp version 1.1.
    

    我将其更改为 1.2 版,问题不再出现。

    【讨论】:

      猜你喜欢
      • 2015-10-05
      • 2018-02-23
      • 2018-09-15
      • 2021-11-29
      • 1970-01-01
      • 1970-01-01
      • 2018-01-24
      • 1970-01-01
      • 2017-07-22
      相关资源
      最近更新 更多