I am using http-client with spring-rabbit in Spring Boot 1.5.6.RELEASE and it works fine.
In Spring Boot 2.0.2.RELEASE http-client is excluded from spring-rabbit pom.xml.
I don't want to manually add http-client and keep track of versions between boot versions.
spring-boot-starter-amqp-1.5.6.RELEASE:
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>
spring-boot-starter-amqp-2.0.2.RELEASE:
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>2.0.3.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>http-client</artifactId>
<groupId>com.rabbitmq</groupId>
</exclusion>
</exclusions>
</dependency>
Why is http-client excluded and can I include it without defining version? Version is 2.0.1.RELEASE but it is not extracted as a property in spring-rabbit.
According to the Spring AMQP documentation the dependency com.rabbitmq:http-client is now optional. Apparently this was changed to allow multiple client implementations.
When the management plugin is enabled, the RabbitMQ server exposes a REST API to monitor and configure the broker. A Java Binding for the API is now provided. The com.rabbitmq.http.client.Client is a standard, immediate and, therefore, blocking API. It is based on the Spring Web module and its RestTemplate implementation. On the other hand, the com.rabbitmq.http.client.ReactorNettyClient is a reactive, non-blocking implementation based on the Reactor Netty project.
The hop dependency (com.rabbitmq:http-client) is now also optional.
See the documentation
If you want to use the standard http-client you can add the dependency. Please that that you don't need to keep track of the correct version yourself. The version is automatically chosen based on your spring-boot-starter-amqp version.
// Maven
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>http-client</artifactId>
</dependency>
// Gradle
compile("com.rabbitmq:http-client")
You can also refer to the related GitHub project on how to enable a specific client: rabbitmq/hop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With