spring-amqp

Delay message to send to listener using Spring AMQP

独自空忆成欢 提交于 2021-02-19 04:22:30
问题 I have a requirement to send message to MessageListener after certain duration , So is there any way to achieve using Spring AMQP. Eg . Producer produces the message and message goes to RabbitMQ Q , The message gets received Listener listening to that Q immediately, I want to delay that message to be received at consumer side say after some configuration parameter say 1000ms 回答1: The RabbitMQ provides for this purpose Delayed Exchange feature. Starting with version 1.6 Spring AMQP also

Spring amqp listener thread recovery

岁酱吖の 提交于 2021-02-10 08:01:45
问题 I am trying to avoid situation, when thread reading messages from queue is dead, but application is up and running, so its hard to detect problem. Lets have code: @RabbitListener(queues = "${enc-correlation.correlation-request-queue}") public void takeIndexTask(@Payload ConversationList list) throws InterruptedException { //just simulation of failure throw new OutOfMemoryError(); } This will end up with application running, but not processing new messages. I tried jvm parameter: -XX

Spring AMQP with two ConnectionFactory

前提是你 提交于 2021-02-08 06:21:24
问题 I have an application with two ConnectionFactory (different brokers). They are configured with java classes: @Bean public ConnectionFactory ... @Bean public Queue ... ... In rabbittemplate you can indicate the connection, but not in queues or in the exchanges, so they are being created in the two connections. Do I have to use RabbitAdmin to create queues in only one of the two connections? is there any other way? 回答1: See the documentation : Conditional Declaration. Starting with the 1.2

Spring Batch - AmqpWriter and AmqpReader example

痴心易碎 提交于 2021-02-07 10:21:48
问题 Need a solution to write a data on RabbitMQ using AmqpWriter and read the data using RabbitMQ using AmqpReader . We're not looking for Apache Kafka, we want to simply send say Program details and consume it. Writer Code JobConfig.java @Configuration public class JobConfig { @Autowired private StepBuilderFactory stepBuilderFactory; @Autowired private JobBuilderFactory jobBuilderFactory; @Bean public ConnectionFactory connectionFactory() { return new CachingConnectionFactory("localhost"); }

Spring Batch - AmqpWriter and AmqpReader example

妖精的绣舞 提交于 2021-02-07 10:20:31
问题 Need a solution to write a data on RabbitMQ using AmqpWriter and read the data using RabbitMQ using AmqpReader . We're not looking for Apache Kafka, we want to simply send say Program details and consume it. Writer Code JobConfig.java @Configuration public class JobConfig { @Autowired private StepBuilderFactory stepBuilderFactory; @Autowired private JobBuilderFactory jobBuilderFactory; @Bean public ConnectionFactory connectionFactory() { return new CachingConnectionFactory("localhost"); }

Spring AMQP - Proper way to register queues to container on startup

扶醉桌前 提交于 2021-01-07 03:28:56
问题 I have a situation where I need to register queues dynamically in a run-time to a SimpleMessageListenerContainer . The problem I am experiencing is a deadlock that happens because of this: Thread: [52] Thread1 wants the lock java.lang.Object@5537e0df org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getDeferredCloseExecutor(CachingConnectionFactory.java:907) org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.restart(SimpleMessageListenerContainer.java

Spring AMQP - Proper way to register queues to container on startup

懵懂的女人 提交于 2021-01-07 03:27:41
问题 I have a situation where I need to register queues dynamically in a run-time to a SimpleMessageListenerContainer . The problem I am experiencing is a deadlock that happens because of this: Thread: [52] Thread1 wants the lock java.lang.Object@5537e0df org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getDeferredCloseExecutor(CachingConnectionFactory.java:907) org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.restart(SimpleMessageListenerContainer.java

how configure timeouts, retries or max-attempts in differents queues with spring rabbitmq

 ̄綄美尐妖づ 提交于 2021-01-03 07:08:40
问题 Is it possible to make these settings for each queue? I have queues that are important so i need a larger number of retries, but have less important queues that I do not want to configure retry, attempt, etc public Queue newQueue(String name) { return new Queue(name, durable, exclusive, autoDelete, arguments); } I saw that in the Queue class, it is possible to pass an argument map as the last parameter, but I do not know if it would be here, or via properties. 回答1: In my case I had to create

RabbitMQ Failed to declare queue and Listener is not able to get queue on server

主宰稳场 提交于 2020-12-31 08:46:38
问题 I have spring boot rabbitmq application where i have to send an Employee object to queue. Then i have set up a listener application. Do some processing on employee object and put this object in call back queue. For this, i have created below objects in my appication. Created ConnectionFactory . Created RabbitAdmin object using ConnectionFactory .. Request Queue. Callback Queue. Direct Exchange. Request Queue Binding. Callback Queue Binding. MessageConverter. RabbitTemplate object. And finally

RabbitMQ Failed to declare queue and Listener is not able to get queue on server

萝らか妹 提交于 2020-12-31 08:46:18
问题 I have spring boot rabbitmq application where i have to send an Employee object to queue. Then i have set up a listener application. Do some processing on employee object and put this object in call back queue. For this, i have created below objects in my appication. Created ConnectionFactory . Created RabbitAdmin object using ConnectionFactory .. Request Queue. Callback Queue. Direct Exchange. Request Queue Binding. Callback Queue Binding. MessageConverter. RabbitTemplate object. And finally