spring-amqp

Dynamically add new queues, bindings and exchanges as beans

会有一股神秘感。 提交于 2019-12-17 19:35:22
问题 I'm currently working on a rabbit-amqp implementation project and use spring-rabbit to programmatically setup all my queues, bindings and exchanges. (spring-rabbit-1.3.4 and spring-framework versions 3.2.0) The declaration in a javaconfiguration class or xml-based configuration are both quite static in my opinion declared. I know how to set a more dynamic value (ex. a name) for a queue, exchange or binding like this: @Configuration public class serverConfiguration { private String queueName;

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?

configuring multiple Vhosts in AMQP in rabbitmq configuration spring boot

扶醉桌前 提交于 2019-12-13 05:06:05
问题 i'm implementing a project where i have to send messages across different vhosts in rabbitmq. using SimpleRoutingConnectionFactory but get java.lang.IllegalStateException: Cannot determine target ConnectionFactory for lookup key [null]. Anyone who has an idea how to implement such below is my configuration class code. @Configuration @EnableRabbit public class RabbitMQConfiguration { @Autowired ConnectionProperties connect; // client1 exchanges @Bean public TopicExchange client1Exchange() {

How to disable RabbitMQ prefetch count with SimpleMessageListenerContainer

倖福魔咒の 提交于 2019-12-13 02:48:50
问题 RabbitMQ offers the ability to optionally set a prefetch count. Using spring-amqp's SimpleMessageListenerContainer , I've noticed the prefetch count is always set. I cannot set the prefetch count to 0, because SimpleMessageListenerContainer sets it to at least txSize which must be greater than zero (even when there are no transactions involved). So is there a way to disable the prefetch count, i.e. make it unlimited? Here is the relevant code from spring-amqp: SimpleMessageListenerContainer

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

Spring amqp batch receiving messages

怎甘沉沦 提交于 2019-12-12 14:14:04
问题 We use Spring AMQP to read message from RabbitMQ, right now we only read one message at a time off the queue, is there anyway I can read multiple messages off the queue then process the batch? I see there is a BatchingStrategy available in Spring, how can i plugin that one into the connectionFactory? here is my code: CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host, port); connectionFactory.setUsername(username); connectionFactory.setPassword(password);

Dynamic addition of queues to a rabbit listener at runtime

自古美人都是妖i 提交于 2019-12-12 12:09:51
问题 I've got a project where we are going to have hundreds (potentially thousands) of queues in rabbit and each of these queues will need to be consumed by a pool of consumers. In rabbit (using spring-amqp), you have the rabbitlistener annotation which allows me to statically assign the queues this particular consumer(s) will handle. My question is - with rabbit and spring, is there a clean way for me to grab a section of queues (lets say queues that start with a-c) and then also listen for any

Spring RabbitMQ tutorial results in Connection Refused error

谁都会走 提交于 2019-12-12 09:56:51
问题 I'm an experienced Java programmer and am trying out Spring Rabbit MQ for the first time. I followed the messaging-rabbitMQ tutorial exactly using Maven. http://spring.io/guides/gs/messaging-rabbitmq/ I am running on CentOS as a user account. When I ran the application at the very end of the tutorial with java -jar target/gs-messaging-rabbitmq-0.1.0.jar , I got the following Connection Refused error. Can someone help? prompt> java -jar target/gs-messaging-rabbitmq-0.1.0.jar . ____ _ __ _ _ /\

Spring AMQP Reporting

旧时模样 提交于 2019-12-12 05:39:57
问题 We are using spring AMQP to listen to rabbitMQ for messages. I want to be able to report the metrics once we finished processing batch of messages, that means when we exhausts all the message in the queue. I m not sure how to do that in Spring AMQP. browsing spring document, it mentions advice chain to SimpleRabbitListenerContainerFactory, but that's mainly for RetryInterceptor. is there anyway allow me to report? 回答1: There is nothing in the framework to notify the listener that there are no