spring-amqp

RabbitMQ & Spring amqp retry without blocking consumers

做~自己de王妃 提交于 2019-12-25 03:58:22
问题 I'm working with RabbitMQ and Spring amqp where I would prefer not to lose messages. By using exponential back off policy for retrying, I'm potentially blocking my consumers which they could be working off on messages they could handle. I'd like to give failed messages several days to retry with the exponential back off policy, but I don't want a consumer blocking for several days and I want it to keep working on the other messages. I know we can achieve this kind of functionality with

Spring AMQP ensuring message order in multi-threaded environment

筅森魡賤 提交于 2019-12-25 03:36:05
问题 RabbitMQ guarantees message order if the same Publish Channel->Exchange->Queue->Receive Channel is used. It appears Spring AMQP allows me to guarantee all those pieces except for the publish channel. This is causing messages to get out of order. Below is the problem case: 1.) I have a single thread publishing messages in order on a single exchange 2.) I have a collection of other threads publishing messages on different exchanges and sometimes creating new consumers for different exchanges

How do I create/configure my own AMQP ContainerFactory in Spring Boot?

心不动则不痛 提交于 2019-12-25 01:53:47
问题 I added this as an attempt to create and configure my own SimpleRabbitListenerContainerFactory to replace the default @Bean open fun myFactory(cf: ConnectionFactory): SimpleRabbitListenerContainerFactory { val factory = SimpleRabbitListenerContainerFactory() factory.setConnectionFactory(cf) factory.setDefaultRequeueRejected(false) factory.setAfterReceivePostProcessors(MessagePostProcessor { it.messageProperties.contentType = MediaType.APPLICATION_JSON_VALUE return@MessagePostProcessor it })

Java RabbitMQ client hangs on resend via thread of producer commit callback after nack due to non-existent exchange

烂漫一生 提交于 2019-12-24 17:07:28
问题 I am currently experimenting with failure scenarios that might happen when communicating via the message broker RabbitMQ. The goal is to evaluate how such communication can be made more resilient. In particular, I want to trigger a nack (not-acknowledge) confirm when sending messages in producer-commit mode. To do so, I send a message to a non-existent exchange via Spring AMQP's RabbitTemplate.send . In the callback provided via RabbitTemplate.setConfirmCallback , I then handle ack=false

What's the difference between SimpleMessageListenerContainer and DirectMessageListenerContainer in Spring AMQP?

老子叫甜甜 提交于 2019-12-24 08:59:13
问题 What's the difference between SimpleMessageListenerContainer and DirectMessageListenerContainer in Spring AMQP? I checked both of their documentation pages, SimpleMessageListenerContainer has almost no explanation on inner workings, and DirectMessageListenerContainer has the following explanation: The SimpleMessageListenerContainer is not so simple. Recent changes to the rabbitmq java client has facilitated a much simpler listener container that invokes the listener directly on the rabbit

Detect and recover from credential deletion in Spring AMQP

孤街浪徒 提交于 2019-12-24 07:33:07
问题 We have a Spring Cloud Config setup, using Vault database backends (MySQL and RabbitMQ), which gives us the ability to inject generated credentials into properties such as: spring.rabbitmq.username spring.rabbitmq.password When our app starts up we have a fresh set of Rabbit credentials, and we have the ability to request a new set on demand. Since our Rabbit credentials are managed externally by Vault, they could be expired / deleted at any time during the app's life (this is also a

Detect and recover from credential deletion in Spring AMQP

被刻印的时光 ゝ 提交于 2019-12-24 07:32:17
问题 We have a Spring Cloud Config setup, using Vault database backends (MySQL and RabbitMQ), which gives us the ability to inject generated credentials into properties such as: spring.rabbitmq.username spring.rabbitmq.password When our app starts up we have a fresh set of Rabbit credentials, and we have the ability to request a new set on demand. Since our Rabbit credentials are managed externally by Vault, they could be expired / deleted at any time during the app's life (this is also a

Deleted queue is not redefined, consumers stop to handle messages

梦想的初衷 提交于 2019-12-24 07:27:09
问题 I'm trying to solve following problem: I have 2 SimpleMessageListenerContainer defined in java conf. Each of them has it's own listener wrapped with adapter and they both use same CachingConnectionFactory(is it ok?). In addition each of them handles different queue(with constant name) I'm testing scenario when for whatever reason one of the queues is deleted. When I'm deleting it manually from web admin console the container tries to redefine this queue and fails(all retries fail). The

Deleted queue is not redefined, consumers stop to handle messages

天涯浪子 提交于 2019-12-24 07:27:08
问题 I'm trying to solve following problem: I have 2 SimpleMessageListenerContainer defined in java conf. Each of them has it's own listener wrapped with adapter and they both use same CachingConnectionFactory(is it ok?). In addition each of them handles different queue(with constant name) I'm testing scenario when for whatever reason one of the queues is deleted. When I'm deleting it manually from web admin console the container tries to redefine this queue and fails(all retries fail). The

Only consuming messages with certain headers using RabbitMQ and SpringAMQP

淺唱寂寞╮ 提交于 2019-12-24 03:46:24
问题 I'm trying to publish a message to a queue and then have certain consumers consume it only if it contains a certain header and another consumer consume it if it contains another header. What I've done so far is to setup a headers-exchange that routes messages to a certain queue only if it contains that header. This is the config I'm using to setup the exchange and the queue and the listener: <!-- Register Queue Listener Beans --> <bean id="ActionMessageListener" class="com.mycee.Action" /> <!