spring-amqp

Spring RabbitTemplate is not creating dead letter queue with TTL

不羁的心 提交于 2019-12-24 03:31:44
问题 I am using spring-rabbit1.1 and RabbitMQ 3.3.1 , My spring configuration will create any queue with the help of RabbitTemplate on Rabbit MQ but if the queue has been configured with x-dead-letter-exchange and x-message-ttl , it just creates the queue with out the TTL and dead letter exchange. For Eg : the below queue will create the queue but TTL and dead letter exhange is not getting created . <rabbit:queue name="hello.queue.dead"> <rabbit:queue-arguments> <entry key="x-dead-letter-exchange"

RabbitMQ : Create Dynamic queues in Direct Exchange

北战南征 提交于 2019-12-24 03:08:13
问题 I am new to RabbitMQ, I just went through Rabbitmq docs (Routing). I am quite confused between Exchange with routing keys. My requirement is , I want to create multiple queues dynamically. Please refer below diagram. Ex. Lets say If producer create message for consumer c3, then it should go to Exchange and route to Queue 3 only and consume by C3 only. At present I only require 3 Queues in future this count may increase. so how to deal with this situation too. Note : I refer this blog Exchange

RabbitTemplate receive messages and requeue

非 Y 不嫁゛ 提交于 2019-12-23 15:40:12
问题 My question is very similar to this one: RabbitTemplate receive and requeue Unfortunately it has been marked as answered though the answer doesn't suit my needs. I want to mimic the functionality of the Rabbit Admin UI, i.e. I want to synchronously read messages from a queue, but don't want the queue to lose them, i.e. something like having a peek. The answer here RabbitTemplate receive and requeue suggests using a listener, but in that case it'll read and requeue indefinitely. I want to get

Can we use AmqpItemReader and AmqpItermWriter for request/reply use case in spring batch?

安稳与你 提交于 2019-12-23 04:54:20
问题 I have seen the AmqpJobSample http://docs.spring.io/spring-batch/spring-batch-samples/#AmqpJobFunctionalTests It uses AmqpItemReader to read from rabbitmq message queue, processes it using message handler and then writes back to queue using AmqpItemWriter. My use case is to, read items from listItemReader which I have implemented, then sends items to messaging queue which will be processed by consumers running on different servers (rabbitmq cluster) and those consumers will respond back

Spring amqp consumer not re-connecting to queue after network failure

别等时光非礼了梦想. 提交于 2019-12-23 04:52:42
问题 We have a spring application which is having a dynamic queue listener connecting to queue in rabbitmq. Let's say I have a total of 5 listener consumer connected to 5 queues from my spring application to rabbitmq. Now if Network fluctuation/failure happens then each time, first one of my 5 connected queues is stopped retrying to rabbitmq. I have debugged code through spring-amqp class and found out that on creating a connection with rabbitmq (when network failure happens), it fails to connect

Spring Cloud Contract and plain Spring AMQP

孤者浪人 提交于 2019-12-23 03:38:12
问题 We are using plain Spring AMQP in our spring boot projects. We want to make sure that our message consumers can test against real messages and avoid to test against static test messages. Thus our producers could generate message snippets in a test phase that can be picked up by the consumer test to make sure it tests against the latest message version and see if changes in the producer break the consumer. It seems like Spring Cloud Contract does exactly that. So is there a way to integrate

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...

java spring rabbit - gracefully reject a message

前提是你 提交于 2019-12-22 10:25:04
问题 I have the following listener method: @Override public void onMessage(Message message, Channel channel) { try { // do something bad :) } catch (Exception e){ try { long dt = null != message.getMessageProperties() ? message.getMessageProperties().getDeliveryTag() : 0; channel.basicReject(dt, true); } catch(IOException io) { logger.error("IO-COMMON", io); } } } The issue is basic reject doesn't work, I don't know why. How to reject it gracefully? I think that if I reject a message, it should be

java spring rabbit - gracefully reject a message

馋奶兔 提交于 2019-12-22 10:18:11
问题 I have the following listener method: @Override public void onMessage(Message message, Channel channel) { try { // do something bad :) } catch (Exception e){ try { long dt = null != message.getMessageProperties() ? message.getMessageProperties().getDeliveryTag() : 0; channel.basicReject(dt, true); } catch(IOException io) { logger.error("IO-COMMON", io); } } } The issue is basic reject doesn't work, I don't know why. How to reject it gracefully? I think that if I reject a message, it should be

Is Spring-AMQP re-queue message count JVM based?

元气小坏坏 提交于 2019-12-22 08:13:10
问题 I was poking around the rabbitmq documentation, and it seems that rabbitmq does not handle message redelivery count. If I were to manually ACK/NACK messages, I would need to either keep the retry count in memory (say, by using correlationId as the unique key in a map), or by setting my own header in the message, and redelivering it (thus putting it at the end of the queue) However, this is a case that spring handles. Specifically, I am referring to RetryInterceptorBuilder.stateful()