Upgrade to Rabbit AMQP Client to 5.4.0

Closes gh-14303
pull/14304/head
Phillip Webb 6 years ago
parent 0cd64ea690
commit 59b5c54489

@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.amqp;
import java.time.Duration;
import java.util.List;
import java.util.Objects;
import com.rabbitmq.client.Channel;
@ -42,7 +41,6 @@ import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.util.ReflectionUtils;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link RabbitTemplate}.
@ -93,11 +91,6 @@ public class RabbitAutoConfiguration {
@ConditionalOnMissingBean(ConnectionFactory.class)
protected static class RabbitConnectionFactoryCreator {
// Only available in rabbitmq-java-client 5.4.0 +
private static final boolean CAN_ENABLE_HOSTNAME_VERIFICATION = ReflectionUtils
.findMethod(com.rabbitmq.client.ConnectionFactory.class,
"enableHostnameVerification") != null;
@Bean
public CachingConnectionFactory rabbitConnectionFactory(
RabbitProperties properties,
@ -149,11 +142,8 @@ public class RabbitAutoConfiguration {
map.from(ssl::getTrustStorePassword).to(factory::setTrustStorePassphrase);
map.from(ssl::isValidateServerCertificate).to((validate) -> factory
.setSkipServerCertificateValidation(!validate));
map.from(ssl::getVerifyHostname).when(Objects::nonNull)
map.from(ssl::getVerifyHostname)
.to(factory::setEnableHostnameVerification);
if (ssl.getVerifyHostname() == null && CAN_ENABLE_HOSTNAME_VERIFICATION) {
factory.setEnableHostnameVerification(true);
}
}
map.from(properties::getConnectionTimeout).whenNonNull()
.asInt(Duration::toMillis).to(factory::setConnectionTimeout);

@ -356,10 +356,9 @@ public class RabbitProperties {
private boolean validateServerCertificate = true;
/**
* Whether to enable hostname verification. Requires AMQP client 4.8 or above and
* defaults to true when a suitable client version is used.
* Whether to enable hostname verification.
*/
private Boolean verifyHostname;
private boolean verifyHostname = true;
public boolean isEnabled() {
return this.enabled;
@ -433,11 +432,11 @@ public class RabbitProperties {
this.validateServerCertificate = validateServerCertificate;
}
public Boolean getVerifyHostname() {
public boolean getVerifyHostname() {
return this.verifyHostname;
}
public void setVerifyHostname(Boolean verifyHostname) {
public void setVerifyHostname(boolean verifyHostname) {
this.verifyHostname = verifyHostname;
}

@ -141,7 +141,7 @@
<postgresql.version>42.2.4</postgresql.version>
<quartz.version>2.3.0</quartz.version>
<querydsl.version>4.2.1</querydsl.version>
<rabbit-amqp-client.version>5.3.0</rabbit-amqp-client.version>
<rabbit-amqp-client.version>5.4.0</rabbit-amqp-client.version>
<reactor-bom.version>Californium-M2</reactor-bom.version>
<rest-assured.version>3.1.1</rest-assured.version>
<reactive-streams.version>1.0.2</reactive-streams.version>

@ -14,7 +14,6 @@
<description>Spring Boot AMQP Sample</description>
<properties>
<main.basedir>${basedir}/../..</main.basedir>
<rabbit-amqp-client.version>5.4.0</rabbit-amqp-client.version>
</properties>
<dependencies>
<!-- Compile -->

Loading…
Cancel
Save