spring-amqp

Spring AMQP Project with 2 queue's

橙三吉。 提交于 2019-11-29 23:35:50
问题 I'm working on a project that involves 2 queue's, and multiples Listeners interacting with them. Flow: New HTTP request comes to the server, then it's converted into a Object that will be the message This message has to be published in two queues I have two types of Listeners that get messages from each queue and then I do whatever I want I've been reading and the best way to do is with a fanout-exchange. Here is my code: listener-configuration.xml <!-- CREATE CONNECTION FACTORY --> <rabbit

How to write an integration test for @RabbitListener annotation?

烈酒焚心 提交于 2019-11-29 14:22:45
My question is really a follow up question to RabbitMQ Integration Test and Threading There it states to wrap "your listeners" and pass in a CountDownLatch and eventually all the threads will merge. This answer works if we were manually creating and injecting the message listener but for @RabbitListener annotations... i'm not sure how to pass in a CountDownLatch. The framework is auto magically creating the message listener behind the scenes. Are there any other approaches? Selwyn With the help of @Gary Russell I was able to get an answer and used the following solution. Conclusion: I must

Requeueing dead letter messages

 ̄綄美尐妖づ 提交于 2019-11-29 12:54:35
Is there any functionality built in to spring-amqp that would make it easy to requeue dead letter messages? I can write code to do it but it seems like such a common use case that would fit well into the framework. Gary Russell This is outside of Spring AMQP, but you can configure a TTL on the dead letter queue and configure that queue to dead-letter back to the original queue when expired. You can check the x-death header if you want to give up completely after some number of retry cycles. See this answer and its question for more information. 来源: https://stackoverflow.com/questions/31248441

Dynamically add new queues, bindings and exchanges as beans

空扰寡人 提交于 2019-11-29 06:14:39
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; ... @Bean public Queue buildQueue() { Queue queue = new Queue(this.queueName, false, false, true,

RabbitMQ RPC across multiple rabbitMQ instances

安稳与你 提交于 2019-11-29 03:40:56
I have three clients each with their own RabbitMQ instances and I have an application (let's call it appA) that has its own RabbitMQ instance, the three client applications (app1, app2, app3) wants to make use of a service on appA. The service on appA requires RPC communication, app1, app2 and app3 each has a booking.request queue and a booking.response queue. With the shovel plugin, I can forward all booking.request messages from app1-3 to appA: Shovel1 virtualHost=appA, name=booking-request-shovel, sourceURI=amqp://userForApp1:password@app1-server/vhostForApp1 queue=booking.request

Spring amqp with RabbitMq: Message is not circled back to live queue after falling off dead letter queue

荒凉一梦 提交于 2019-11-28 14:25:39
I am trying to achieve this . There are so many conflicting answers to know if its possible or not. According to previous link, it is not possible. But in another question on this forum, somebody remarked that they were able to here and in the comment section here . So, Is it possible to do live queue => dead-letter-queue => live queue Or do I need to use a particular version of RabbitMq to achieve this ? I am able to do: live queue => dead-letter-queue and dead-letter-queue => live queue. You can't do it if the dead-lettering from alive is due to expiry - according to the documentation... It

How is concurrency in Spring AMQP Listener Container implemented?

我们两清 提交于 2019-11-28 09:06:17
My container XML config: <rabbit:listener-container connection-factory="myConnectionFactory" acknowledge="none" concurrency="10" requeue-rejected="false"> <rabbit:listener ref="myListener" queues="myQueue"/> </rabbit:listener-container> and myListener is just a class @Component("myListener") public class MyListener implements MessageListener { @Autowired SomeDependency dependency; .... } I've specified concurrency="10" in my XML. What does this mean exactly ? I've found some docs . They are not that helpful stating: Specify the number of concurrent consumers to create. Default is 1. What I am

Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN

泪湿孤枕 提交于 2019-11-28 05:10:03
I am getting below exception org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile. Configuration: RabbitMQ 3.3.5 on windows On Config file in %APPDATA%\RabbitMQ\rabbit.config I have done below change as per https://www.rabbitmq.com/access-control.html [{rabbit, [{loopback_users, []}]}]. I also tried creating a user/pwd - test/test doesn't seem to make it work. Tried the Steps from this post. Other Configuration Details are as below:

Spring RabbitMQ - using manual channel acknowledgement on a service with @RabbitListener configuration

允我心安 提交于 2019-11-27 19:30:38
How to acknowledge the messages manually without using auto acknowledgement. Is there a way to use this along with the @RabbitListener and @EnableRabbit style of configuration. Most of the documentation tells us to use SimpleMessageListenerContainer along with ChannelAwareMessageListener . However using that we lose the flexibility that is provided with the annotations. I have configured my service as below : @Service public class EventReceiver { @Autowired private MessageSender messageSender; @RabbitListener(queues = "${eventqueue}") public void receiveMessage(Order order) throws Exception {

Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN

佐手、 提交于 2019-11-27 19:18:59
问题 I am getting below exception org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile. Configuration: RabbitMQ 3.3.5 on windows On Config file in %APPDATA%\RabbitMQ\rabbit.config I have done below change as per https://www.rabbitmq.com/access-control.html [{rabbit, [{loopback_users, []}]}]. I also tried creating a user/pwd - test/test