spring-rabbit

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

Failover with Spring AMQP and RabbitMQ HA

耗尽温柔 提交于 2019-12-12 12:23:18
问题 There are multiple articles suggesting that load-balancer should be used in front of RabbitMQ cluster. However, there are also multiple references that Spring AMQP is using some failover implementation like connection reset when broker comes back to life. I have several questions regarding this topic (given that those articles are more or less old and it's 2018 today) When using Spring AMQP, is it load-balancing for still required? If load-balancing is still suggested, how would I solve

Null response for spring-amqp Request/Reply Messaging

半腔热情 提交于 2019-12-12 01:42:39
问题 I'm following the instructions for the Stock Trading sample, which outlines how to use request/reply messaging in spring-amqp : http://static.springsource.org/spring-amqp/docs/1.2.x/reference/html/sample-apps.html#d4e742 I've tweaked the sample instructions to create a client which should wait for the reply by using convertSendAndReceive instead of convertAndSend : https://gist.github.com/pulkitsinghal/5774487 Now even though the reply is put on the responseQueue and I've updated the timeout

Not able to process response received from template.convertSendAndReceive()

流过昼夜 提交于 2019-12-11 23:18:51
问题 I am trying to send message and receive response using following code MessageProperties props =MessagePropertiesBuilder.newInstance().setContentType(MessageProperties.CONTENT_TYPE_TEXT_PLAIN) .setMessageId("MSG12345").setHeader("type", "type1").setCorrelationId(UUID.randomUUID().toString().getBytes()).build(); Message message = MessageBuilder.withBody(input.getBytes()).andProperties(props).build(); Message response = (Message) template.convertSendAndReceive("key", message); But, its is

file inbound-channel-adapter performance issue

白昼怎懂夜的黑 提交于 2019-12-11 20:22:00
问题 We have a spring integration application which will monitor on an incoming folder then process the files. When the application is down for maintenance or some other reason the incoming folder is filled with 100K files by upstream application. When restart application it is getting frozen it is not processing incoming files may be trying to load all the incoming files. Here is configuration <file:inbound-channel-adapter id="inFiles" channel="inFilesin" directory="file:${incoming.folder}" queue

spring rabbitmq automatic recovery enable

本秂侑毒 提交于 2019-12-11 18:34:41
问题 @Bean public StatefulRetryOperationsInterceptor interceptor() { return RetryInterceptorBuilder.stateful() .maxAttempts(5) .backOffOptions(1000, 2.0, 10000) .build(); } Can we use this bean for spring-rabbitmq automatic recovery because spring rabbit does not supports factory.setAutomaticRecoveryEnabled(true); factory.setNetworkRecoveryInterval(10000); 回答1: It's not clear what your question is. The retry @Bean is for retrying when your application listener fails to process a message. The

RabbitHandler to create consumer and retry on Fatal Exception in Spring for queue on listening to rabbitmq

时光毁灭记忆、已成空白 提交于 2019-12-11 17:18:07
问题 I am using Spring AMQP RabbitHandler and have wrote the following code:- @RabbitListener(queues = "#{testQueue.name}") public class Tut4Receiver { @RabbitHandler public void receiveMessage(String message){ System.out.println("Message received "+message); } } Also Queue is defined like:- @Bean public Queue testQueue() { return new AnonymousQueue(); } I am using seperate code to initialise the Connection Factory. My question is if rabbitmq is down for some time,it keeps on retrying to create a

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 {

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