Unable to configure retry for Spring AMQP RabbitMQ (Spring Boot 2.0.2) - rabbitmq

I'm working with a Spring Boot 2.0.2 application and I want to configure RabbitMq to retry failed messages 3 times, with an interval between each retry.
Previously on Spring Boot 1.5.1 I have successfully setup this on application.properties:
spring.rabbitmq.listener.retry.enabled=true
spring.rabbitmq.listener.retry.initial-interval=45000
spring.rabbitmq.listener.retry.max-attempts=3
spring.rabbitmq.listener.retry.multiplier=1.3
spring.rabbitmq.listener.retry.max-interval=80000
I've tried do the same on Spring Boot 2.0.2 but it doesn't work. I've read that these properties have changed in Spring Boot 2.0, but even after updating the properties, it still doesn't work:
spring.rabbitmq.listener.direct.retry.enabled=true
spring.rabbitmq.listener.direct.retry.initial-interval=45000
spring.rabbitmq.listener.direct.retry.max-attempts=3
spring.rabbitmq.listener.direct.retry.multiplier=1.3
spring.rabbitmq.listener.direct.retry.max-interval=80000
Am I missing something?

The default container type is simple.
Use spring.rabbitmq.listener.simple.retry.enabled=true unless you decide to use the direct container type instead.
See Choosing a Container.
The DMLC was added in Spring AMQP 2.0; the boot properties were deprecated in a later 1.5.x release, switching to the ...simple... properties in preparation for Boot 2.0.

Related

How I can use Sleuth Span in spring boot 2

Trying to upgrade from spring boot 1 to 2, The problem I'm facing is with tracing
In spring boot 1, we are using sleuth Trace that seems like deprecated in the spring boot 2 and suggesting to use 'brave'.
One of the problems is our another microservices are using spring boot 1, how I can carry the Span in spring boot 2? It is deprecated.
I tried to use the sleuth old version, but getting conflicts and spring application is failing to start
If one of your applications is using sleuth 1.x and the other 2.x they will be able to pass and continue the tracing context. In the wiki page here we describe how to migrate from one version to another https://github.com/spring-cloud/spring-cloud-sleuth/wiki/Spring-Cloud-Sleuth-2.0-Migration-Guide

Apache Ignite with Spring framework

Does the Apache Ignite operate on a spring framework basis?
Can I register a spring controller in classpath at server remote node and use it?(using component , like #Controller)
Apache Ignite is integrated with Spring but isn't based on it.
You can register spring beans when starting remote node (using normal spring approach) and then use them from e.g. compute or distributed services.
I'm not sure if you can register beans remotely in runtime, but I don't see why not.

Highest RabbitMq compatibility as Message Bus for Spring XD 1.3.0.RELEASE

I'm trying to figure out what the highest version of RabbitMq that I can use with Spring XD 1.3.0.RELEASE.
Basically we are using Rabbit as a message bus in Spring XD. Also we are using it as a source or sink (custom modules) in some streams.
Current version we are using is RabbitMq 3.6.10
I wouldn't expect any problems using it with the latest release (currently 3.7.15).

RabbitListener stops processing messages and kind of stuck sometimes

Environment : Spring boot 1.4.0 , RMQ Client : 4.0.1 , CloudFoundry
I have application that has following simple rmq conn factory definition
#Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.setUsername(user);
connectionFactory.setPassword(password);
connectionFactory.setHost(host);
connectionFactory.setPort(port);
return connectionFactory;
}
And simple listener method annotated with #RabbitListener. It works fine. Recently I have noticed couple times that even though I had 5k messages in queue it was not processing. On RMQ admin console I saw it has consumer too. I tried to took thread dump but didnt find anything interesting. Is there anything specially that I should look into thread dump (I have /dump endpoint). This happens anytime, so by the time I will notice logs will be scrolled (if anything) since other traffic like couple simple rest endpoint being invoked time to time. So that tells me that application itself is up, but just this listener part is kind of stuck or hung. I did search on this issue, there were some issues with this but fixed long back. (I don't want to go to pull model please :))
Please advise on how should I troubleshoot this. I have to wait again now to see this issue as I restarted application and it is working fine.
There is a known problem when the underlying rabbitmq connection factory has autoRecoveryEnabled set to true.
The 4.0.x client library now enables this by default but Spring AMQP doesn't need it; it has always had it's own recovery logic.
It is fixed in 1.6.8 and 1.7.1 (boot 1.4.0 comes with 1.6.1 by default). Boot 1.4.5 comes with 1.6.8.
1.7.1 also disables the option in the 4.0.x client (unless you specifically provide a rabbitmq connection factory).
Boot 1.5.2 comes with 1.7.1 by default.
Options:
Upgrade to a newer boot
Upgrade to a newer spring-amqp and spring-rabbit jar
Turn off autoRecovery in the underlying connection factory.

Consuming Spring Boot "metricsChannel" via Apache Camel/RabbitMQ

Spring Boot publishes all metrics events to a message channel "metricsChannel" when a dependency on spring-messaging is present. In my project I am using Apache Camel along with RabbitMQ as the broker. Is there any way to consume these metrics messages using purely Camel and not spring integration?
I can see Apache Camel has a component SpringIntegration, however I would like to know if there is a way to directly access these messages via the RabbitMQ component or do I have to add dependency on the camel component spring-integration as well?
It would be far easier for you to implement MetricChannel and do whatever you want with Camel instead of trying to bridge a result with Spring integration. Look at MessageChannelMetricWriter, the implementation is quite straightforward.