Update dependencies; prepare for release
* Adapt AMQP module for the latest Spring AMQP changes
This commit is contained in:
38
build.gradle
38
build.gradle
@@ -18,8 +18,8 @@ plugins {
|
||||
id 'org.sonarqube' version '2.8'
|
||||
id 'io.spring.nohttp' version '0.0.11' apply false
|
||||
id 'org.ajoberstar.grgit' version '4.1.1'
|
||||
id 'io.spring.dependency-management' version '1.1.0'
|
||||
id 'com.jfrog.artifactory' version '4.32.0' apply false
|
||||
id 'io.spring.dependency-management' version '1.1.3'
|
||||
id 'com.jfrog.artifactory' version '5.1.10' apply false
|
||||
id 'org.jetbrains.dokka' version '1.7.20'
|
||||
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
|
||||
id 'org.asciidoctor.jvm.gems' version '3.3.2'
|
||||
@@ -50,10 +50,10 @@ ext {
|
||||
|
||||
apacheSshdVersion = '2.9.2'
|
||||
artemisVersion = '2.27.1'
|
||||
aspectjVersion = '1.9.19'
|
||||
aspectjVersion = '1.9.20.1'
|
||||
assertjVersion = '3.24.2'
|
||||
assertkVersion = '0.25'
|
||||
avroVersion = '1.11.1'
|
||||
avroVersion = '1.11.3'
|
||||
awaitilityVersion = '4.2.0'
|
||||
camelVersion = '3.19.0'
|
||||
commonsDbcp2Version = '2.9.0'
|
||||
@@ -63,9 +63,9 @@ ext {
|
||||
derbyVersion = '10.16.1.1'
|
||||
findbugsVersion = '3.0.1'
|
||||
ftpServerVersion = '1.2.0'
|
||||
graalvmVersion = '22.3.2'
|
||||
graalvmVersion = '22.3.3'
|
||||
greenmailVersion = '2.0.0'
|
||||
groovyVersion = '4.0.12'
|
||||
groovyVersion = '4.0.15'
|
||||
hamcrestVersion = '2.2'
|
||||
hazelcastVersion = '5.2.4'
|
||||
hibernateVersion = '6.1.7.Final'
|
||||
@@ -73,11 +73,11 @@ ext {
|
||||
h2Version = '2.1.214'
|
||||
jacksonVersion = '2.14.3'
|
||||
jaxbVersion = '4.0.3'
|
||||
jcifsVersion = '2.1.34'
|
||||
jeroMqVersion = '0.5.3'
|
||||
jcifsVersion = '2.1.36'
|
||||
jeroMqVersion = '0.5.4'
|
||||
jmsApiVersion = '3.1.0'
|
||||
jpaApiVersion = '3.1.0'
|
||||
jrubyVersion = '9.3.10.0'
|
||||
jrubyVersion = '9.3.11.0'
|
||||
jsonpathVersion = '2.7.0'
|
||||
junit4Version = '4.13.2'
|
||||
junitJupiterVersion = '5.9.3'
|
||||
@@ -87,8 +87,8 @@ ext {
|
||||
lettuceVersion = '6.2.6.RELEASE'
|
||||
log4jVersion = '2.19.0'
|
||||
mailVersion = '1.0.0'
|
||||
micrometerTracingVersion = '1.0.9'
|
||||
micrometerVersion = '1.10.10'
|
||||
micrometerTracingVersion = '1.0.11'
|
||||
micrometerVersion = '1.10.12'
|
||||
mockitoVersion = '4.10.0'
|
||||
mongoDriverVersion = '4.8.2'
|
||||
mysqlVersion = '8.0.33'
|
||||
@@ -96,22 +96,22 @@ ext {
|
||||
pahoMqttClientVersion = '1.2.5'
|
||||
postgresVersion = '42.5.4'
|
||||
r2dbch2Version = '1.0.0.RELEASE'
|
||||
reactorVersion = '2022.0.8'
|
||||
reactorVersion = '2022.0.12'
|
||||
resilience4jVersion = '1.7.1'
|
||||
romeToolsVersion = '1.18.0'
|
||||
rsocketVersion = '1.1.4'
|
||||
servletApiVersion = '6.0.0'
|
||||
smackVersion = '4.4.6'
|
||||
springAmqpVersion = '3.0.5'
|
||||
springDataVersion = '2022.0.9'
|
||||
springAmqpVersion = '3.0.10'
|
||||
springDataVersion = '2022.0.11'
|
||||
springGraphqlVersion = '1.1.5'
|
||||
springKafkaVersion = '3.0.10'
|
||||
springRetryVersion = '2.0.2'
|
||||
springSecurityVersion = '6.0.6'
|
||||
springVersion = '6.0.11'
|
||||
springKafkaVersion = '3.0.12'
|
||||
springRetryVersion = '2.0.4'
|
||||
springSecurityVersion = '6.0.8'
|
||||
springVersion = '6.0.13'
|
||||
springWsVersion = '4.0.4'
|
||||
testcontainersVersion = '1.17.6'
|
||||
tomcatVersion = '10.1.10'
|
||||
tomcatVersion = '10.1.14'
|
||||
xmlUnitVersion = '2.9.1'
|
||||
xstreamVersion = '1.4.20'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,11 +23,20 @@ import org.springframework.amqp.rabbit.connection.Connection;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionListener;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.converter.AllowedListDeserializingMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
|
||||
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
|
||||
import org.springframework.integration.amqp.support.MappingUtils;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.integration.message.AdviceMessage;
|
||||
import org.springframework.integration.support.MutableMessage;
|
||||
import org.springframework.integration.support.MutableMessageHeaders;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -87,6 +96,19 @@ public abstract class AbstractAmqpChannel extends AbstractMessageChannel impleme
|
||||
this.amqpTemplate = amqpTemplate;
|
||||
if (amqpTemplate instanceof RabbitTemplate) {
|
||||
this.rabbitTemplate = (RabbitTemplate) amqpTemplate;
|
||||
MessageConverter converter = this.rabbitTemplate.getMessageConverter();
|
||||
if (converter instanceof AllowedListDeserializingMessageConverter allowedListMessageConverter) {
|
||||
allowedListMessageConverter.addAllowedListPatterns(
|
||||
"java.util*",
|
||||
"java.lang*",
|
||||
GenericMessage.class.getName(),
|
||||
ErrorMessage.class.getName(),
|
||||
AdviceMessage.class.getName(),
|
||||
MutableMessage.class.getName(),
|
||||
MessageHeaders.class.getName(),
|
||||
MutableMessageHeaders.class.getName(),
|
||||
MessageHistory.class.getName());
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.rabbitTemplate = null;
|
||||
@@ -143,7 +165,7 @@ public abstract class AbstractAmqpChannel extends AbstractMessageChannel impleme
|
||||
|
||||
/**
|
||||
* When mapping headers for the outbound message, determine whether the headers are
|
||||
* mapped before the message is converted, or afterwards. This only affects headers
|
||||
* mapped before the message is converted, or afterward. This only affects headers
|
||||
* that might be added by the message converter. When false, the converter's headers
|
||||
* win; when true, any headers added by the converter will be overridden (if the
|
||||
* source message has a header that maps to those headers). You might wish to set this
|
||||
@@ -242,10 +264,6 @@ public abstract class AbstractAmqpChannel extends AbstractMessageChannel impleme
|
||||
doDeclares();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(Connection connection) {
|
||||
}
|
||||
|
||||
protected abstract void doDeclares();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.amqp.AmqpConnectException;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.amqp.core.MessageListener;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer;
|
||||
@@ -77,6 +78,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
*/
|
||||
protected AbstractSubscribableAmqpChannel(String channelName, AbstractMessageListenerContainer container,
|
||||
AmqpTemplate amqpTemplate) {
|
||||
|
||||
this(channelName, container, amqpTemplate, false);
|
||||
}
|
||||
|
||||
@@ -93,6 +95,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
*/
|
||||
protected AbstractSubscribableAmqpChannel(String channelName, AbstractMessageListenerContainer container,
|
||||
AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper) {
|
||||
|
||||
this(channelName, container, amqpTemplate, false, outboundMapper, inboundMapper);
|
||||
}
|
||||
|
||||
@@ -108,6 +111,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
protected AbstractSubscribableAmqpChannel(String channelName,
|
||||
AbstractMessageListenerContainer container,
|
||||
AmqpTemplate amqpTemplate, boolean isPubSub) {
|
||||
|
||||
this(channelName, container, amqpTemplate, isPubSub,
|
||||
DefaultAmqpHeaderMapper.outboundMapper(), DefaultAmqpHeaderMapper.inboundMapper());
|
||||
}
|
||||
@@ -128,14 +132,16 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
AbstractMessageListenerContainer container,
|
||||
AmqpTemplate amqpTemplate, boolean isPubSub,
|
||||
AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper) {
|
||||
|
||||
super(amqpTemplate, outboundMapper, inboundMapper);
|
||||
Assert.notNull(container, "container must not be null");
|
||||
Assert.hasText(channelName, "channel name must not be empty");
|
||||
this.channelName = channelName;
|
||||
this.container = container;
|
||||
this.isPubSub = isPubSub;
|
||||
setConnectionFactory(container.getConnectionFactory());
|
||||
setAdmin(new RabbitAdmin(getConnectionFactory()));
|
||||
ConnectionFactory connectionFactory = container.getConnectionFactory();
|
||||
setConnectionFactory(connectionFactory);
|
||||
setAdmin(new RabbitAdmin(connectionFactory));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,11 +179,13 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
setMaxSubscribers(this.maxSubscribers);
|
||||
String queue = obtainQueueName(this.channelName);
|
||||
this.container.setQueueNames(queue);
|
||||
MessageConverter converter = (this.getAmqpTemplate() instanceof RabbitTemplate)
|
||||
? ((RabbitTemplate) this.getAmqpTemplate()).getMessageConverter()
|
||||
MessageConverter converter =
|
||||
(getAmqpTemplate() instanceof RabbitTemplate rabbitTemplate)
|
||||
? rabbitTemplate.getMessageConverter()
|
||||
: new SimpleMessageConverter();
|
||||
MessageListener listener = new DispatchingMessageListener(converter,
|
||||
this.dispatcher, this, this.isPubSub,
|
||||
|
||||
MessageListener listener =
|
||||
new DispatchingMessageListener(converter, this.dispatcher, this, this.isPubSub,
|
||||
getMessageBuilderFactory(), getInboundHeaderMapper());
|
||||
this.container.setMessageListener(listener);
|
||||
if (!this.container.isActive()) {
|
||||
@@ -256,7 +264,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
|
||||
private static final class DispatchingMessageListener implements MessageListener {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
private final Log logger = LogFactory.getLog(DispatchingMessageListener.class);
|
||||
|
||||
private final MessageDispatcher dispatcher;
|
||||
|
||||
@@ -273,6 +281,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
private DispatchingMessageListener(MessageConverter converter,
|
||||
MessageDispatcher dispatcher, AbstractSubscribableAmqpChannel channel, boolean isPubSub,
|
||||
MessageBuilderFactory messageBuilderFactory, AmqpHeaderMapper inboundHeaderMapper) {
|
||||
|
||||
Assert.notNull(converter, "MessageConverter must not be null");
|
||||
Assert.notNull(dispatcher, "MessageDispatcher must not be null");
|
||||
this.converter = converter;
|
||||
@@ -308,7 +317,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
|
||||
}
|
||||
}
|
||||
|
||||
protected Message<Object> buildMessage(org.springframework.amqp.core.Message message, Object converted) {
|
||||
private Message<Object> buildMessage(org.springframework.amqp.core.Message message, Object converted) {
|
||||
AbstractIntegrationMessageBuilder<Object> messageBuilder =
|
||||
this.messageBuilderFactory.withPayload(converted);
|
||||
if (this.channel.isExtractPayload()) {
|
||||
|
||||
Reference in New Issue
Block a user