Questions tagged [spring-amqp]

Spring components for AMQP-based messaging.

The Spring AMQP project applies core Spring concepts to the development of AMQP-based messaging solutions. It provides a "template" as a high-level abstraction for sending and receiving messages. It also provides support for Message-driven POJOs. Its libraries facilitate management of AMQP resources while promoting the use of dependency injection and declarative configuration. In all of these cases, you will see similarities to the JMS support in the Spring Framework.

The spring-amqp sub-project is a general abstraction, with spring-rabbit being the implementation for RabbitMQ.

Resources

See Also

1608 questions
13
votes
5 answers

Is it possible to set prefetch count on @RabbitListener

I know it is possible to make SimpleMessageListenerContainer bean and set prefetch count and message listener here, like this: @Bean public SimpleMessageListenerContainer messageListenerContainer( ConnectionFactory rabbitConnectionFactory, …
Ruslan Stelmachenko
  • 4,987
  • 2
  • 36
  • 51
12
votes
2 answers

Spring AMQP - Sender and Receiving Messages

I am facing an issue in receiving a message from RabbitMQ. I am sending a message like below HashMap senderMap=new HashMap<>(); senderMap.put("STATUS", "SUCCESS"); senderMap.put("EXECUTION_START_TIME", new…
BIndu_Madhav
  • 577
  • 1
  • 8
  • 21
12
votes
2 answers

Cannot obtain exclusive access to locked queue

I have an anonymous and exclusive queue defined like this: @Bean public SimpleMessageListenerContainer responseMessageListenerContainer(){ SimpleMessageListenerContainer container = new…
jandres
  • 439
  • 1
  • 7
  • 21
12
votes
2 answers

How do we hook into before/After message processing using @RabbitListener

Problem: I am migrating from MessageListener interface impl to @RabbitListener. I had logic like this where I was doing "pre" and "post" message processing on a MessageListener that was inherited by several classes example: public…
Selwyn
  • 3,118
  • 1
  • 26
  • 33
12
votes
4 answers

Spring with AMQP and RabbitMQ, queue with optional x-dead-letter-exchange

I have an existing queue created in RabbitMQ. It can be created with or without x-dead-letter-exchange parameter. I am creating a consumer of this queue in Spring using the RabbitTemplate. When I declare the queue, I don't want to specify the…
MartinTeeVarga
  • 10,478
  • 12
  • 61
  • 98
12
votes
2 answers

spring boot rabbitmq MappingJackson2MessageConverter custom object conversion

I'm trying to create a simple spring boot app with spring boot that "produce" messages to a rabbitmq exchange/queue and another sample spring boot app that "consume" these messages. So I have two apps (or microservices if you wish). 1) "producer"…
Gustavo
  • 526
  • 1
  • 4
  • 13
11
votes
1 answer

Dynamic addition of queues to a rabbit listener at runtime

I've got a project where we are going to have hundreds (potentially thousands) of queues in rabbit and each of these queues will need to be consumed by a pool of consumers. In rabbit (using spring-amqp), you have the rabbitlistener annotation which…
user10776719
  • 301
  • 4
  • 15
11
votes
1 answer

What benefits does Spring AMQP have over Spring Cloud Stream for Microservices Architecture

I use Spring Cloud approach for building few microservices which supposed to interact with each other. For messaging between microservices I intended to use RabbitMQ and Spring AMQP, but after I looked at Spring Cloud Stream I feel lost. In my mind…
Evgeny M
  • 417
  • 7
  • 15
11
votes
2 answers

Retrieving number of unacknowledged messages in RabbitMQ queue from Java/ Spring

is there any way to return the number of messages that are unacknowledged? I am using this code to get the number of messages in the queue: DeclareOk declareOk = amqpAdmin.getRabbitTemplate().execute( new ChannelCallback() { …
11
votes
2 answers

Queue Size in Spring AMQP Java client

I am using Spring amqp 1.1 version as my java client. I have a queue which has around 2000 messages. I want to have a service which checks this queue size and and if it is empty it will send out a message saying " All items processed". I dont know…
hellojava
  • 4,904
  • 9
  • 30
  • 38
10
votes
1 answer

Rabbitmq reload/refresh new certificates without restart

I am using self signed certificates in my Rabbitmq server and the broker is started successfully with SSL port. I am now trying to renew / use new SSL certificates, SSL key and truststore but I do not want to restart the running rabbitmq server as…
10
votes
4 answers

How to deal with JSON message with spring-rabbit in spring boot application?

Here are my code snippets. MQConfiguration class for configuration @Configuration public class MQConfiguration { @Bean public Receiver receiver() { return new Receiver(); } } Receiver class for dealing with receiving…
kenshinji
  • 2,021
  • 4
  • 25
  • 39
10
votes
1 answer

Why need messageId in AMQP?

In the Spring AMQP Project, if messageProperties does not have messageId, they always create messageId. Like This.. if (this.createMessageIds && messageProperties.getMessageId()==null) { …
Minwoo
  • 213
  • 4
  • 12
10
votes
1 answer

how to use @queuebinding with @rabbitlistener?

Seems since spring-amqp version 1.5, there is a new annotation @queuebinding。But how to use it, i don't know if it can be used on a class or a method? Does it exist any example?
GrapeBaBa
  • 1,391
  • 3
  • 12
  • 22
10
votes
3 answers

Implementing non-blocking retry with backoff with spring-amqp and rabbitmq

I am looking for a good way to implement retries with a backoff policy using spring amqp and Rabbit MQ, but the requirement is that the listener should not be blocked (so it is free to process other messages). I see a similar question asked/answered…
alam86
  • 101
  • 1
  • 5