spring-rabbitmq

Rabbitmq : Failed message being reprocessed in an infinite loop

橙三吉。 提交于 2019-12-24 00:43:52
问题 This is the rabbitmq configuration that I have : <rabbit:admin connection-factory="rmqConnectionFactory"/> <bean id="**retryAdvice**" class="org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean"> <property name="retryOperations" ref="retryTemplate"/> </bean> <bean id="**retryTemplate**" class="org.springframework.retry.support.RetryTemplate"> <property name="retryPolicy" ref="simpleRetryPolicy"/> <property name="backOffPolicy"> <bean class="org.springframework

SpringAMQP RabbitMQ how to send directly to Queue without Exchange

心已入冬 提交于 2019-12-22 10:39:26
问题 I'm using SpringAMQP with Rabbit template. How to send messages directly to Queues omitting Exchange? How can i do it? 回答1: How can i do it? You can't; publishers don't know about queues; just exchanges and routing keys. However, all queues are bound to the default exchange ( "" ) with the queue name as its routing key. If you are using Spring AMQP's RabbitTemplate , it is configured to publish to the default exchange by default, so you can use convertAndSend("myQueue", "foo")` Or even...

Spring AMQP - Message re queuing using dead letter mechanism with TTL

有些话、适合烂在心里 提交于 2019-12-22 00:25:06
问题 Its like " Houston we have a problem here " where I need to schedule/delay a message for 5 minutes after it fails on the first attempt to process an event. I have implemented dead letter exchange in this scenario. The messages on failing, route to the DLX --> Retry Queue and comes back to work queue after a TTL of 5 minutes for another attempt. Here is the configuration I am using: public class RabbitMQConfig { @Bean(name = "work") @Primary Queue workQueue() { return new Queue(WORK_QUEUE,

How to start, stop and reconnect spring rabbitmq listener containers and their connections?

本秂侑毒 提交于 2019-12-21 02:41:42
问题 I've an internet connection where the exit gateway periodically changes. I'm getting an event or callback notification to my spring application some seconds before this happens. I would like to stop my rabbit consumers and connections then and connect again after some seconds (when my network connection is back). I'm using the annotation based approach of spring amqp but i could also switch to another kind of implementation. I know that spring-amqp is doing a reconnect for me but i would like

DLX in rabbitmq and spring-rabbitmq - some considerations of rejecting messages

旧城冷巷雨未停 提交于 2019-12-20 05:38:32
问题 I did read this reference: https://www.rabbitmq.com/dlx.html, however it doesn't resolve my doubts, namely: In case of accepting message there is no problem - spring-rabbitmq send ack and everthing is fine, DLX doesn't know about acked message. The problem is in case rejecting answer, namely what about throwing MessageConverterException ? This message is removed or moved to DLX ? And what about in case other exception ? For example Exception ? It is removed/requeued/moved to DLX ? Edit after

Large RabbitMQ message in Slow network

吃可爱长大的小学妹 提交于 2019-12-20 03:05:38
问题 I am using RabbitMQ with Spring AMQP large message (>100MB, 102400KB) small bandwidth (<512Kbps) low heartbeat interval (10 seconds) single broker It will take >= 200*8 seconds to consume the message, which is more than my heartbeat interval. From https://stackoverflow.com/a/42363685/418439 If the message transfer time between nodes (60seconds?) > heartbeat time between nodes, it will cause the cluster to disconnect and the loose the message Will I also face the disconnection issue even I am

How can @MessagingGateway be configured with Spring Cloud Stream MessageChannels?

烂漫一生 提交于 2019-12-18 06:23:10
问题 I have developed asynchronous Spring Cloud Stream services, and I am trying to develop an edge service that uses @MessagingGateway to provide synchronous access to services that are async by nature. I am currently getting the following stack trace: Caused by: org.springframework.messaging.core.DestinationResolutionException: no output-channel or replyChannel header available at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler

Problem adding queues using SmartLifecycle at runtime

孤人 提交于 2019-12-14 04:06:30
问题 So, this is new question related to this one I have created a case where ListenerContainer is actually run before @Bean with phase 0, even though it has phase Integer.MAX_INT . Here is the code: import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.springframework.amqp.core.QueueBuilder; import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation

Spring AMQP RabbitMQ RPC - Handle response exceptions

て烟熏妆下的殇ゞ 提交于 2019-12-13 06:38:27
问题 I am trying to use a RPC AMQP RabbitMQ queue to send and receive messages. The problem is that I have set a setReplyTimeout value. When that happens I get a "org.springframework.amqp.AmqpRejectAndDontRequeueException: Reply received after timeout". I have a DLQ set up on the incoming queue, but it appears that the exception is received when spring tries to return the message on its queue that is automatically created. Thus how can I handle exceptions when sending messages back to a producer?

Spring AMQP Notification/Events on SimpleMessageListenerContainer, when queue gets deleted

微笑、不失礼 提交于 2019-12-13 01:29:34
问题 I have a scenario where I am consuming messages from queues using SimpleMessageListenerContainer . When any of these subscribed queues got deleted, I would like to get notification or events. SimpleMessageListenerContainer simpleMessageListenerContainer = new SimpleMessageListenerContainer(cachingConnectionFactory); simpleMessageListenerContainer.setQueueNames( "testQueue1","testQueue2","testQueue3"); simpleMessageListenerContainer.start(); 回答1: There is currently no event published when a