0
votes

I am writing application that uses STOMP for communication. Server side is written using Spring Boot 2.1.7 and as external broker RabbitMQ 3.7.1 is used. On client side, I am using StompJS.

When client subscribes to user destination, eg. /user/queue/some-queue Spring will map it to /queue/some-queue-{sessionID} and RabbitMQ creates queue with corresponding name.

On subscription I added header {'auto-delete': true}, as specified here RabbitMQ Stomp Docs, and that created auto delete queue in RabbitMQ.

Problem comes when I try sending message to user as

simpTemplate.convertAndSendToUser('user', '/queue/some-queue', message)

Spring correctly translated queue name, but rabbitmq responds with error

PRECONDITION_FAILED - inequivalent arg 'auto_delete' for queue

What can I do to fix this issue?

1
Any chance to have a simple project from you to play with? - Artem Bilan
@ArtemBilan I will create one and share it. Thank you. - Boris
@ArtemBilan Hi, I created simple project link. I added most basic security and similar. The received problem is same. Thanks. - Boris
Sorry, would you mind to share some instruction or test how to reproduce the issue? Looks like I need to do a lot of work to make the client connected to that server to make it fail. - Artem Bilan
Of course, sorry. I added Readme file with instructions. - Boris

1 Answers

0
votes

I think I found a solution. If I add same same headers, which were defined during subscription, when sending message, it will work correctly.

On example it looks like this:

Map<String, Object> headers = new HashMap<>();
headers.put("auto-delete", "true");
simpMessagingTemplate.convertAndSendToUser("some-user", "/queue/some-queue", "Test payload", headers);