spring-rabbitmq

Negative Acknowledgement to RabbitMQ Queue to Re-Queue the Message using Spring AMQP

﹥>﹥吖頭↗ 提交于 2019-12-12 01:56:26
问题 I have an application which uses spring AMQP for consuming and producing messages to other application. I have a scenario where some of the exception occurred i need to re-queue back to RabbitMQ. For some exceptions i need to ignore (Basically i need to ignore the message no need to requeue) Currently in below code, i have set the configuration as factory.setDefaultRequeueRejected(false); But my requirement is to dynamically reject for some messages and re-queue back to RabbitMQ for some

Dynamically selecting a RabbitMq queue in Exchange using spring integration

隐身守侯 提交于 2019-12-11 23:52:46
问题 From producer I have to send message to an RabbitMQ Exchange. this message will contain specific attribute, for example , queue name, based on this attribute, I have to dynamically decide the queue to send this message.[queue to bind from exchange, to send this particular message]. is there any way to intercept the message arriving to a RabbitMQ Exchange, using spring integration, At present , I have the following spring integration config file. I don't know to how to create a bean to get

Delayed requeuing through Rabbit DLQ

半腔热情 提交于 2019-12-11 17:42:36
问题 I am trying to set up a queue with delayed requeuing of failed messages following the pattern described here. I tried copying the config example from the docs as closely as possible but the dead letter queue that was created was not itself bound back to the DLX. I am unclear as to why not. I saw another potential solution though and instead of relying on the default behavior, I tried explicitly setting the dlqDeadLetterExchange and dlqDeadLetterRoutingKey properties to see if I could make

RabbitHandler to create consumer and retry on Fatal Exception in Spring for queue on listening to rabbitmq

时光毁灭记忆、已成空白 提交于 2019-12-11 17:18:07
问题 I am using Spring AMQP RabbitHandler and have wrote the following code:- @RabbitListener(queues = "#{testQueue.name}") public class Tut4Receiver { @RabbitHandler public void receiveMessage(String message){ System.out.println("Message received "+message); } } Also Queue is defined like:- @Bean public Queue testQueue() { return new AnonymousQueue(); } I am using seperate code to initialise the Connection Factory. My question is if rabbitmq is down for some time,it keeps on retrying to create a

Log4J 2 version not working with RabbitMQ & Spring Boot

一曲冷凌霜 提交于 2019-12-11 12:13:42
问题 I have below pom.xml in RabbitMQ Project. Attached sample code too. Can anybody help me with error i am facing. I tried implementing various solution on net but no success. I tried using Log4J xml too. I read on many sites that if i am using log4j then i have to exclude some dependancies also. in my pom xml i have excluded them. But still no success. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache

How to implement an ApplicationListener in DirectMessageListenerContainer

柔情痞子 提交于 2019-12-11 10:55:44
问题 Can anyone please guide on how to programatically register an ApplicationListener in DirectMessageListenerContainer(spring rabbitmq) to handle the ListenerContainerConsumerFailedEvent Thanks In Advance. 回答1: The listener is not registered to the container; it is simply added as a @Bean to the Spring application context; the container publishes the event and Spring dispatches it to each registered listener. EDIT Don't put code in comments; they don't render well - always edit the question

How to gracefully stop consuming messages with @RabbitListener

旧时模样 提交于 2019-12-11 10:15:48
问题 Is there a way to gracefully stop a ListenerContainer , and its associated Consumers . What I'm trying to achieve. Stop consuming messages. Gracefully stop ListenerContainer . Await long running consumers, and ack when finished. I'm able to stop the ListenerContainers using consumer.stop() , but active long running consumers won't complete successfully, and processed messages won't be acked and will therefore be processed again, once the ListenerContainer has been resumed. Output Waiting for

SimpleMessageListener vs DirectMessageListener

蓝咒 提交于 2019-12-11 05:43:44
问题 I'm trying to see difference between DirectMessageListener and SimpleMessageListener . I have this drawing just to ask if it is correct. Let me try to describe how I understood it and maybe you tell me if it is correct. In front of spring-rabbit there is rabbit-client java library, that is connecting to rabbit-mq server and delivering messages to spring-rabbit library. This client has some ThreadPoolExecutor (which has in this case I think - 16 threads). So, it does not matter how many queues

How to use multiple vhosts in a Spring RabbitMQ project?

拟墨画扇 提交于 2019-12-11 04:38:04
问题 I've the following two Configuration classes: @Configuration @EnableRabbit @Import({ LocalRabbitConfigA.class, CloudRabbitConfigA.class }) public class RabbitConfigA { @Autowired @Qualifier("rabbitConnectionFactory_A") private ConnectionFactory rabbitConnectionFactory; @Bean(name = "admin_A") AmqpAdmin amqpAdmin() { return new RabbitAdmin(rabbitConnectionFactory); } @Bean(name = "Exchange_A") DirectExchange receiverExchange() { return new DirectExchange("Exchange_A", true, false); } } And

SimpleMessageListenerContainer shutdowntimeout

别等时光非礼了梦想. 提交于 2019-12-11 04:29:08
问题 I am using spring-rabbit-1.7.3.RELEASE.jar I have defined a SimpleMessageListenerContainer in my xml with shutdownTimeout parameter. bean id="aContainer" class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer"> <property name="connectionFactory" ref="rabbitConnectionFactory" /> <property name="queueNames" value="aQueue" /> <property name="adviceChain" ref="retryAdvice" /> <property name="acknowledgeMode" value="AUTO" /> <property name="shutdownTimeout" value="900000" /