Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Spring AMQP sends message to RabbitMQ and receives x-queue-type error

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Error message received when sending message to RabbitMQ using Spring AMQP:

inequivalent arg 'x-queue-type' for queue 'com.ossez.real.estate' in vhost '/': received none but current is the value 'classic' of type 'longstr', class-id=50, method-id=10

The error message above is obvious, indicating that the x-queue-type parameter is missing from the queue parameter for sending messages.

In the code, we create queues with parameters:

return new Queue(MY_QUEUE_NAME, NON_DURABLE);

args.put("x-queue-type", "classic");

Therefore, we need to add the above parameters when creating the queue.

Change the code to:

Map args = new HashMap();

// // set the queue with a dead letter feature

args.put("x-queue-type", "classic");

return new Queue(MY_QUEUE_NAME, NON_DURABLE, false, false, args);

Please refer to the code in GitHub:

https://github.com/cwiki-us-demo/tutorials/blob/master/spring-amqp/src/main/java/com/baeldung/springamqp/simple/HelloWorldMessageApp.java

https://blog.ossez.com/archives/3050

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report