spring-amqp

Registering a listener service with setMessageListener

橙三吉。 提交于 2019-12-11 17:09:05
问题 I have a spring amqp app that i want to use but i can't seem to know how to get it to register my listener service. This is my annotation based configuration file. package com.jerry.configuration; import org.springframework.amqp.core.AmqpAdmin; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.core.RabbitAdmin; import

rabbitmq channel shutdown with PRECONDITION_FAILED - fast reply consumer does not exist

核能气质少年 提交于 2019-12-11 16:59:11
问题 We are getting the below error when we are posting a message to rabbitmq from a spring boot service. Also this is intermittent and we are not able to reproduce this. [AMQP Connection 123.11.xxx.xx:5672] ERROR [] org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Channel shutdown: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - fast reply consumer does not exist, class-id=60, method-id=40) Does anyone faced similar issue with rabbitmq

Is exchange type not available at sender side in Spring AMQP RabbitMQ codes?

一笑奈何 提交于 2019-12-11 16:17:44
问题 I have a basic question in RabbitMQ. In case of Spring AMQP, in both XML configuration and Java configuration using annotations, the type of exchange being used is known only at the listener side. I mean to at, only the consumer configuration code contains the type of exchange being used (topic/direct/fanout). At the sender side we will have - amqpTemplate.convertAndSend("exchange_name", "routing_key",sampleMessage); So is it like the sender code is not bothered or aware of the type(topic

Getting NPE while receiving the reply message using RabbitTemplate

大兔子大兔子 提交于 2019-12-11 15:24:43
问题 I have two microservices. one contains the REST controller which has the Get method which receives the message when sent to specific queue. other microservice just sends the reply message to same queue so that processed message can be seen in the browser when hit the REST API however, getting NPE while receiving the message. below is the complete stack-trace: 2018-05-19 15:46:13.409 INFO 30104 --- [nio-8097-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/unit] : Initializing Spring FrameworkServlet

RabbitMQ Spring Boot application handle broker down

大兔子大兔子 提交于 2019-12-11 14:49:30
问题 I have a Spring Boot application configured to connect to a local RabbitMQ broker. I have also configured a FixedBackOff strategy in order to stop retrying connecting after 3 unsuccessful attempts. EDIT 1: I have the following configuration for FixedBackOff as explained by @gary-russell in here: @Bean(name = "rabbitListenerContainerFactory") public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory( SimpleRabbitListenerContainerFactoryConfigurer configurer,

How to send messages asynchronously to queue them up without waiting for reply of each message in spring amqp using rabbitmq in java?

十年热恋 提交于 2019-12-11 13:17:40
问题 I am trying to use rabbitmq using spring amqp, below is my configuration. <rabbit:connection-factory id="rabbitConnectionFactory" port="${rabbitmq.port}" host="${rabbitmq.host}" /> <rabbit:admin connection-factory="rabbitConnectionFactory" /> <rabbit:queue name="${rabbitmq.import.queue}" /> <rabbit:template id="importAmqpTemplate" connection-factory="rabbitConnectionFactory" queue="${rabbitmq.import.queue}" routing-key="${rabbitmq.import.queue}"/> <rabbit:listener-container connection-factory

RabbitMQ fixed reply and consumer configutation

耗尽温柔 提交于 2019-12-11 13:08:31
问题 I'm aiming to achieve the following: php code sends request to queue - java code reads from code - java code sends reply to fixed reply queue - php code reads the reply. I have set up the following test (producer is for now in java): POJO: public class PojoListener { public String handleMessage(String foo) { System.out.println("IN MESSAGE RECEIVER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); return foo.toUpperCase(); } } Configuration: @Configuration public class FixedReplyQueueConfig {

Why is there a delay in Spring AMQP Message dispatching from a filled Queue?

流过昼夜 提交于 2019-12-11 12:27:05
问题 I am using Spring AMQP in my message driven application. I noticed that there is a nearly constant delay of around 300ms between invocations of my message listener, even though I am sure that the queue is filled with messages. The logfile below shows this delay between BlockingQueueConsumer.nextMessage and BlockingQueueConsumer.handle with a call to BlockingQueueConsumer.handleDelivery from another thread in between: 2015-05-12 12:46:18,655 TRACE [SimpleAsyncTaskExecutor-1]

Is it possible to have an async message receiver in Spring AMQP that handles multiple content types?

泄露秘密 提交于 2019-12-11 11:53:54
问题 I'm using an asyncronous message receiver in Spring-AMQP to receive messages. Currently only messages with JSON content are handled, but I have a requirement to also handle messages with XML content. My current implementation of MessageListener has a MessageConverter injected and uses it in onMessage(Message) , like this: MyMessage myMessage = (MyMessage) jsonConverter.fromMessage(message); In order to support different content types I could obviously use the MessageProperties to interrogate

Spring AMQP return callback vs retry callback

三世轮回 提交于 2019-12-11 11:42:25
问题 I want to make my app resilient to connection issues that can happen when sending messages to rabbitmq. I want to get hold of all unsent messages, store them and send them latter, when rabbitmq becomes available. Looking at the official documentation I didn't manage to figure out what is the difference between return callback and retry callback. I understand that retry callback is invoked when retry template exhausts configured policy but don't find this much useful since context doesn't