spring-amqp

Execution of Rabbit message listener failed, and no ErrorHandler has been set. Failed to invoke target method with argument type = [class [B],

寵の児 提交于 2019-12-30 09:29:18
问题 I am using spring amqp rabbitmq, and sending messages using Message message = MessageBuilder .withBody(item.toString().getBytes()) .setReplyTo("importReply") .setCorrelationId(item.toString().getBytes()).build(); My message handler is public class Foundation { public Message importExchange(Message exchange) { System.out.println("Command:" + exchange.getBody()); Message message = MessageBuilder .withBody(exchange.getBody().toString().getBytes()).setCorrelationId(exchange.getMessageProperties()

How do we hook into before/After message processing using @RabbitListener

只愿长相守 提交于 2019-12-30 06:32:30
问题 Problem: I am migrating from MessageListener interface impl to @RabbitListener. I had logic like this where I was doing "pre" and "post" message processing on a MessageListener that was inherited by several classes example: public AbstractMessageListener implements MessageListener { @Override public void onMessage(Message message) { //do some pre message processing process(Message message); // do some post message processing } protected abstract void process(Message message); } Question: Is

Requeueing dead letter messages

旧街凉风 提交于 2019-12-29 08:22:19
问题 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. 回答1: 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

spring batch remote chunking doesn't queue messages but runs it locally?

对着背影说爱祢 提交于 2019-12-25 12:47:43
问题 Below is my configuration for spring batch remote chunking. My steps are running locally instead of remotely. I cant see messages in rabbitmq. <beans:bean id="importExchangesChunkItemWriter" class="org.springframework.batch.integration.chunk.ChunkMessageChannelItemWriter" scope="step" p:messagingOperations-ref="importExchangesMessagingTemplate" p:replyChannel-ref="importExchangesReplyChannel"> </beans:bean> <beans:bean id="importExchangesChunkHandler" class="org.springframework.batch

spring batch remote chunking doesn't queue messages but runs it locally?

痴心易碎 提交于 2019-12-25 12:47:06
问题 Below is my configuration for spring batch remote chunking. My steps are running locally instead of remotely. I cant see messages in rabbitmq. <beans:bean id="importExchangesChunkItemWriter" class="org.springframework.batch.integration.chunk.ChunkMessageChannelItemWriter" scope="step" p:messagingOperations-ref="importExchangesMessagingTemplate" p:replyChannel-ref="importExchangesReplyChannel"> </beans:bean> <beans:bean id="importExchangesChunkHandler" class="org.springframework.batch

Spring AMQP and ShutdownSignalException

倖福魔咒の 提交于 2019-12-25 08:25:10
问题 I have an AMQP Project with Spring AMQP. The RabbitMQ Server is not mine, so I have no control over it. When my application starts, it makes a private response queue like this: @Bean(name="myAnonymousResponseQueue") public Queue myAnonymousResponseQueue() { Queue q = myAmqpAdmin().declareQueue(); return q; } And I have a SimpleMessageListenerContariner like this: @Bean public SimpleMessageListenerContainer myResponseMessageListenerContainer() { SimpleMessageListenerContainer container = new

Spring amqp: detect shutdown and reconnect to another queue

蹲街弑〆低调 提交于 2019-12-25 08:15:03
问题 We have this setup where we call a webservice to create a queue, and receive the queue name from the response. Then we set up a SimpleMessageListenerContainer and set the queue name there, and then start it. However, from time to time, the queue is deleted - resulting in a " 404 could not declare queue XXXXXXXXX " error. In these cases, I need to call the webservice again and add the new QueueName to the SimpleMessageListenerContainer and then removing the old one. The only way I figured out

Dynamic SendTo annotation

回眸只為那壹抹淺笑 提交于 2019-12-25 05:37:05
问题 I have Java code as following to receive messages form a queue, process it and write processed message to another queue. @RabbitListener(queues = "rawFusion") @SendTo("Fusion") public String receiverFusion(Object _message) { String message = getMessage(_message); return messageParser.parse(message); } Here i always get messages from "rawFusion" queue and write it into "Fusion" queue. The thing I want to do is, writing messages different queues depending on some conditions. So i would like

how to send response from consumer to producer to the particular request using Spring AMQP?

拥有回忆 提交于 2019-12-25 04:21:53
问题 we have one problem statement in our application where we are getting null response at the producer end. 1> Producer will produce message (REQUEST_QUEUE) and it will wait for the response. Object receivedData = amqpTemplate.convertSendAndReceive("IKEY123456"); System.out.println("RESPONSE DATA: " + receivedData); 2> At consumer end it will consume message and Class TestConsumer { AmqpTemplate amqpTemplate; public void methodA(){ String msg = (String)amqpTemplate.receiveAndConvert() process

how to send response from consumer to producer to the particular request using Spring AMQP?

痞子三分冷 提交于 2019-12-25 04:21:01
问题 we have one problem statement in our application where we are getting null response at the producer end. 1> Producer will produce message (REQUEST_QUEUE) and it will wait for the response. Object receivedData = amqpTemplate.convertSendAndReceive("IKEY123456"); System.out.println("RESPONSE DATA: " + receivedData); 2> At consumer end it will consume message and Class TestConsumer { AmqpTemplate amqpTemplate; public void methodA(){ String msg = (String)amqpTemplate.receiveAndConvert() process