spring-amqp

spring amqp enable retry by configuration and prevent it according to a specified exception

若如初见. 提交于 2019-12-02 11:00:44
I have the following two cases In case of ExceptionA : retrying for finite number of times and finally when number of retrials exhausted, message is written in a dead letter queue In case of ExceptionB : simply, message should be written to dead letter queue I want to support the two cases on the same listener container factory and the same queue. I already have the following configuration to support case 1 successfully: @Bean public RetryOperationsInterceptor workMessagesRetryInterceptor() { return RetryInterceptorBuilder.stateless() .maxAttempts(5) .backOffOptions(1000, 2, 10000) .recoverer

spring amqp-outbound gateway to produce reply from a different thead (Like jms-outbound gateway)

爱⌒轻易说出口 提交于 2019-12-02 10:18:05
Problem statement: Spring amqp-outbound gateway to produce reply from a different thread (Like jms-outbound gateway, having different queue, correlate the request/response using correlation key). Unable to correlate the message with this example. Spring integration <int:gateway id="outboundGateway" service-interface="com.amqp.outbound.gateway.OutboundGateway" default-reply-channel="defaultReplyChannel" > <int:method name="process" request-channel="inboundRequestChannel"/> </int:gateway> <int:channel id="defaultReplyChannel"/> <int:channel id="inboundRequestChannel"/> <int:channel id=

DLX in rabbitmq and spring-rabbitmq - some considerations of rejecting messages

喜你入骨 提交于 2019-12-02 09:54:51
I did read this reference: https://www.rabbitmq.com/dlx.html , however it doesn't resolve my doubts, namely: In case of accepting message there is no problem - spring-rabbitmq send ack and everthing is fine, DLX doesn't know about acked message. The problem is in case rejecting answer, namely what about throwing MessageConverterException ? This message is removed or moved to DLX ? And what about in case other exception ? For example Exception ? It is removed/requeued/moved to DLX ? Edit after answer of @Gary I think, that after answer's @Gary I should add more details about my case and some

How can I transmit via MQTT and Receive on AMQP with RabbitMQ and Spring-AMQP

牧云@^-^@ 提交于 2019-12-02 07:41:23
So I've gotten MQTT -> MQTT and AMQP -> AMQP to work; the translation of MQTT -> AMQP doesn't seem to be working somewhere though. Here's my test, it passes if my "listener" is also in MQTT using paho, but this rabbitmq implementation doesn't. @SpringBootTest @SpringJUnitConfig internal open class ProvisioningTest @Autowired constructor( private val mqtt: IMqttAsyncClient, private val mapper: ObjectMapper ) { @Test fun provision() { val entity = Foley( rfid = UUID.randomUUID().toString(), ) val called = AtomicBoolean(false) mqtt.subscribe("foley/created", 1) { _, _ -> called.set(true) } mqtt

Spring Amqp has NoClassDefFoundError in springframework RetryCallback class

二次信任 提交于 2019-12-02 07:02:53
I have been working on a distributed web project and I want to utilize Spring amqp using RabbitMq in it. I use springFramework version 4.1.6 in my project. To do this, I have added the following dependencies to the file pom.xml. <dependency> <groupId>com.rabbitmq</groupId> <artifactId>amqp-client</artifactId> <version>3.5.7</version> </dependency> <dependency> <groupId>org.springframework.amqp</groupId> <artifactId>spring-amqp</artifactId> <version>1.5.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.amqp</groupId> <artifactId>spring-rabbit</artifactId> <version>1.5

rabbitmq with spring amqp - messages stuck in case of AmqpException

六眼飞鱼酱① 提交于 2019-12-01 18:55:58
I am throwing an AmqpException inside of my consumer. My expectation is that the message will return back to the queue in FIFO order and will be reprocessed sometime in the future. It seems as if Spring AMQP does not release the message back to the queue. But instead tries to reprocess the failed messages over and over again. This blocks the newly arrived messages from being processed. The ones that are stuck appear in the "unpacked" state forever inside of the AMQP console. Any thoughts? Gary Russell That's the way rabbitmq/Spring AMQP works; if a message is rejected (any exception is thrown)

RabbitMQ basic.get and acknowledgement

梦想与她 提交于 2019-12-01 13:23:18
问题 I'm invoking: GetResponse response = channel.basicGet("some.queue", false); // no auto-ack .... channel.basicAck(deliveryTag, ...); However, when I invoke basicGet , the messages in the queue stay in "Ready", rather than in "Unacknowledged". I want them to be in unacknowledged, so that I can either basic.ack them (thus discarding them from the queue), or basic.nack them 回答1: I'm doing the following to mimic Delaying the ack : At consumption time Get(consume) the message form the initial Queue

Spring AMQP: Register BlockedListener to Connection

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 11:06:32
I am trying to implement Blocked Listeners to RabbitMQ using RabbitTemplate of Spring AMQP. In my code i am using Spring-amqp 1.1.3 version jar file, whereas i have looked into the version 1.3.1 as well and this is unsupported in this version also. Does anyone know if i am missing any version which has support of registering Blocked listeners to the new connections in RabbitMQ. Or if is there any future release of spring amqp to support this feature. Example Code: Connection connection = factory.newConnection(); connection.addBlockedListener(new BlockedListener() { @Override public void

SimpleMessageListenerContainer Error Handling

可紊 提交于 2019-12-01 10:58:34
I'm using a SimpleMessageListenerContainer as a basis for remoting over AMQP. Everything goes smooth provided that the RabbitMQ broker can be reached at process startup. However, if by any reason it can't be reached (network down, permissions problem, etc...) the container just keeps retrying to connect forever. How can I set up a retry behaviour in this case (for example, try at most 5 times with an exponential backoff and then abort, killing the process)? I've had a look at this , but it doesn't seem to work for me on container startup. Can anyone please shed some light? At the very least, I

What is the difference between prefetch count vs no ack in rabbitmq

笑着哭i 提交于 2019-12-01 10:11:09
I need to know what is the difference between prefetch count vs no ack in rabbitmq ? Also What is the difference between following statements :- if i set prefetch count say 10 does 10 consumer threads are created ? Or -- if i register 10 cosumers will it create 10 threads ? Which of the above is more efficient Pre-fetch count: How many messages the consumer should read from queue and kept internally rather than picking one message at a time. No-Ack: Do not acknowledge back that the consumer is done consuming the message. Those both are used to fine tune your set-up To address your second part