Only X
Only X

Reputation: 37

Spring Boot Stomp-Transaction Sockjs: ERROR message=[Bad transaction] Invalid transaction identifier

I implemented a RelayMessageBroker to Rabbitmq with Spring Boot and its working as intended. I use a JavaScript-Client via SockJS to subscribe to queues and to receive/send messages.

I only run into problems trying to use stomp transaction.

My JS-Code:

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

And Spring closes the connection with the error:

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"

Upvotes: 0

Views: 233

Answers (1)

Only X
Only X

Reputation: 37

I found the solution myself: sockjs tried to connect via

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

I changed it to version 1.2 and the problem does not occour anymore.

Upvotes: 0

Related Questions