Skip to content

Commit 3fc372b

Browse files
committed
Update dependencies; prepare for release
* Adapt AMQP module for the latest Spring AMQP changes
1 parent 68f977a commit 3fc372b

File tree

3 files changed

+62
-35
lines changed

3 files changed

+62
-35
lines changed

build.gradle

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ buildscript {
1515
}
1616

1717
plugins {
18-
id 'org.sonarqube' version '4.3.0.3225'
18+
id 'org.sonarqube' version '4.4.1.3373'
1919
id 'io.spring.nohttp' version '0.0.11' apply false
2020
id 'org.ajoberstar.grgit' version '4.1.1'
21-
id 'io.spring.dependency-management' version '1.1.2'
22-
id 'com.jfrog.artifactory' version '4.33.1' apply false
21+
id 'io.spring.dependency-management' version '1.1.3'
22+
id 'com.jfrog.artifactory' version '5.1.10' apply false
2323
id 'org.jetbrains.dokka' version "$kotlinVersion"
2424
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
2525
id 'org.asciidoctor.jvm.convert' version '3.3.2'
@@ -52,9 +52,9 @@ ext {
5252
aspectjVersion = '1.9.20.1'
5353
assertjVersion = '3.24.2'
5454
assertkVersion = '0.26.1'
55-
avroVersion = '1.11.2'
55+
avroVersion = '1.11.3'
5656
awaitilityVersion = '4.2.0'
57-
camelVersion = '3.20.6'
57+
camelVersion = '3.20.7'
5858
commonsDbcp2Version = '2.9.0'
5959
commonsIoVersion = '2.11.0'
6060
commonsNetVersion = '3.9.0'
@@ -67,13 +67,13 @@ ext {
6767
groovyVersion = '4.0.15'
6868
hamcrestVersion = '2.2'
6969
hazelcastVersion = '5.2.4'
70-
hibernateVersion = '6.2.8.Final'
70+
hibernateVersion = '6.2.13.Final'
7171
hsqldbVersion = '2.7.2'
7272
h2Version = '2.2.224'
73-
jacksonVersion = '2.15.2'
73+
jacksonVersion = '2.15.3'
7474
jaxbVersion = '4.0.3'
7575
jcifsVersion = '2.1.36'
76-
jeroMqVersion = '0.5.3'
76+
jeroMqVersion = '0.5.4'
7777
jmsApiVersion = '3.1.0'
7878
jpaApiVersion = '3.1.0'
7979
jrubyVersion = '9.4.3.0'
@@ -83,11 +83,11 @@ ext {
8383
jythonVersion = '2.7.3'
8484
kotlinCoroutinesVersion = '1.6.4'
8585
kryoVersion = '5.5.0'
86-
lettuceVersion = '6.2.4.RELEASE'
86+
lettuceVersion = '6.2.6.RELEASE'
8787
log4jVersion = '2.20.0'
8888
mailVersion = '1.0.0'
89-
micrometerTracingVersion = '1.1.5'
90-
micrometerVersion = '1.11.4'
89+
micrometerTracingVersion = '1.1.6'
90+
micrometerVersion = '1.11.5'
9191
mockitoVersion = '5.3.1'
9292
mongoDriverVersion = '4.9.1'
9393
mysqlVersion = '8.0.33'
@@ -96,22 +96,22 @@ ext {
9696
postgresVersion = '42.6.0'
9797
protobufVersion = '3.23.4'
9898
r2dbch2Version = '1.0.0.RELEASE'
99-
reactorVersion = '2022.0.11'
99+
reactorVersion = '2022.0.1'
100100
resilience4jVersion = '2.0.2'
101101
romeToolsVersion = '2.1.0'
102102
rsocketVersion = '1.1.4'
103103
servletApiVersion = '6.0.0'
104104
smackVersion = '4.4.6'
105-
springAmqpVersion = '3.0.9'
106-
springDataVersion = '2023.0.4'
105+
springAmqpVersion = '3.0.10'
106+
springDataVersion = '2023.0.5'
107107
springGraphqlVersion = '1.2.3'
108-
springKafkaVersion = '3.0.11'
109-
springRetryVersion = '2.0.3'
110-
springSecurityVersion = '6.1.4'
111-
springVersion = '6.0.12'
108+
springKafkaVersion = '3.0.12'
109+
springRetryVersion = '2.0.4'
110+
springSecurityVersion = '6.1.5'
111+
springVersion = '6.0.13'
112112
springWsVersion = '4.0.6'
113-
testcontainersVersion = '1.19.0'
114-
tomcatVersion = '10.1.13'
113+
testcontainersVersion = '1.19.1'
114+
tomcatVersion = '10.1.14'
115115
xmlUnitVersion = '2.9.1'
116116
xstreamVersion = '1.4.20'
117117
ztZipVersion = '1.16'

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractAmqpChannel.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,11 +23,20 @@
2323
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
2424
import org.springframework.amqp.rabbit.connection.ConnectionListener;
2525
import org.springframework.amqp.rabbit.core.RabbitTemplate;
26+
import org.springframework.amqp.support.converter.AllowedListDeserializingMessageConverter;
27+
import org.springframework.amqp.support.converter.MessageConverter;
2628
import org.springframework.integration.amqp.support.AmqpHeaderMapper;
2729
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
2830
import org.springframework.integration.amqp.support.MappingUtils;
2931
import org.springframework.integration.channel.AbstractMessageChannel;
32+
import org.springframework.integration.history.MessageHistory;
33+
import org.springframework.integration.message.AdviceMessage;
34+
import org.springframework.integration.support.MutableMessage;
35+
import org.springframework.integration.support.MutableMessageHeaders;
3036
import org.springframework.messaging.Message;
37+
import org.springframework.messaging.MessageHeaders;
38+
import org.springframework.messaging.support.ErrorMessage;
39+
import org.springframework.messaging.support.GenericMessage;
3140
import org.springframework.util.Assert;
3241

3342
/**
@@ -87,6 +96,19 @@ public abstract class AbstractAmqpChannel extends AbstractMessageChannel impleme
8796
this.amqpTemplate = amqpTemplate;
8897
if (amqpTemplate instanceof RabbitTemplate) {
8998
this.rabbitTemplate = (RabbitTemplate) amqpTemplate;
99+
MessageConverter converter = this.rabbitTemplate.getMessageConverter();
100+
if (converter instanceof AllowedListDeserializingMessageConverter allowedListMessageConverter) {
101+
allowedListMessageConverter.addAllowedListPatterns(
102+
"java.util*",
103+
"java.lang*",
104+
GenericMessage.class.getName(),
105+
ErrorMessage.class.getName(),
106+
AdviceMessage.class.getName(),
107+
MutableMessage.class.getName(),
108+
MessageHeaders.class.getName(),
109+
MutableMessageHeaders.class.getName(),
110+
MessageHistory.class.getName());
111+
}
90112
}
91113
else {
92114
this.rabbitTemplate = null;
@@ -143,7 +165,7 @@ protected boolean isExtractPayload() {
143165

144166
/**
145167
* When mapping headers for the outbound message, determine whether the headers are
146-
* mapped before the message is converted, or afterwards. This only affects headers
168+
* mapped before the message is converted, or afterward. This only affects headers
147169
* that might be added by the message converter. When false, the converter's headers
148170
* win; when true, any headers added by the converter will be overridden (if the
149171
* source message has a header that maps to those headers). You might wish to set this
@@ -242,10 +264,6 @@ public void onCreate(Connection connection) {
242264
doDeclares();
243265
}
244266

245-
@Override
246-
public void onClose(Connection connection) {
247-
}
248-
249267
protected abstract void doDeclares();
250268

251269
}

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
import org.springframework.amqp.AmqpConnectException;
2525
import org.springframework.amqp.core.AmqpTemplate;
2626
import org.springframework.amqp.core.MessageListener;
27+
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
2728
import org.springframework.amqp.rabbit.core.RabbitAdmin;
2829
import org.springframework.amqp.rabbit.core.RabbitTemplate;
2930
import org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer;
@@ -77,6 +78,7 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel
7778
*/
7879
protected AbstractSubscribableAmqpChannel(String channelName, AbstractMessageListenerContainer container,
7980
AmqpTemplate amqpTemplate) {
81+
8082
this(channelName, container, amqpTemplate, false);
8183
}
8284

@@ -93,6 +95,7 @@ protected AbstractSubscribableAmqpChannel(String channelName, AbstractMessageLis
9395
*/
9496
protected AbstractSubscribableAmqpChannel(String channelName, AbstractMessageListenerContainer container,
9597
AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper) {
98+
9699
this(channelName, container, amqpTemplate, false, outboundMapper, inboundMapper);
97100
}
98101

@@ -108,6 +111,7 @@ protected AbstractSubscribableAmqpChannel(String channelName, AbstractMessageLis
108111
protected AbstractSubscribableAmqpChannel(String channelName,
109112
AbstractMessageListenerContainer container,
110113
AmqpTemplate amqpTemplate, boolean isPubSub) {
114+
111115
this(channelName, container, amqpTemplate, isPubSub,
112116
DefaultAmqpHeaderMapper.outboundMapper(), DefaultAmqpHeaderMapper.inboundMapper());
113117
}
@@ -128,14 +132,16 @@ protected AbstractSubscribableAmqpChannel(String channelName,
128132
AbstractMessageListenerContainer container,
129133
AmqpTemplate amqpTemplate, boolean isPubSub,
130134
AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper) {
135+
131136
super(amqpTemplate, outboundMapper, inboundMapper);
132137
Assert.notNull(container, "container must not be null");
133138
Assert.hasText(channelName, "channel name must not be empty");
134139
this.channelName = channelName;
135140
this.container = container;
136141
this.isPubSub = isPubSub;
137-
setConnectionFactory(container.getConnectionFactory());
138-
setAdmin(new RabbitAdmin(getConnectionFactory()));
142+
ConnectionFactory connectionFactory = container.getConnectionFactory();
143+
setConnectionFactory(connectionFactory);
144+
setAdmin(new RabbitAdmin(connectionFactory));
139145
}
140146

141147
/**
@@ -173,11 +179,13 @@ public void onInit() {
173179
setMaxSubscribers(this.maxSubscribers);
174180
String queue = obtainQueueName(this.channelName);
175181
this.container.setQueueNames(queue);
176-
MessageConverter converter = (this.getAmqpTemplate() instanceof RabbitTemplate)
177-
? ((RabbitTemplate) this.getAmqpTemplate()).getMessageConverter()
182+
MessageConverter converter =
183+
(getAmqpTemplate() instanceof RabbitTemplate rabbitTemplate)
184+
? rabbitTemplate.getMessageConverter()
178185
: new SimpleMessageConverter();
179-
MessageListener listener = new DispatchingMessageListener(converter,
180-
this.dispatcher, this, this.isPubSub,
186+
187+
MessageListener listener =
188+
new DispatchingMessageListener(converter, this.dispatcher, this, this.isPubSub,
181189
getMessageBuilderFactory(), getInboundHeaderMapper());
182190
this.container.setMessageListener(listener);
183191
if (!this.container.isActive()) {
@@ -256,7 +264,7 @@ public void destroy() {
256264

257265
private static final class DispatchingMessageListener implements MessageListener {
258266

259-
private final Log logger = LogFactory.getLog(this.getClass());
267+
private final Log logger = LogFactory.getLog(DispatchingMessageListener.class);
260268

261269
private final MessageDispatcher dispatcher;
262270

@@ -273,6 +281,7 @@ private static final class DispatchingMessageListener implements MessageListener
273281
private DispatchingMessageListener(MessageConverter converter,
274282
MessageDispatcher dispatcher, AbstractSubscribableAmqpChannel channel, boolean isPubSub,
275283
MessageBuilderFactory messageBuilderFactory, AmqpHeaderMapper inboundHeaderMapper) {
284+
276285
Assert.notNull(converter, "MessageConverter must not be null");
277286
Assert.notNull(dispatcher, "MessageDispatcher must not be null");
278287
this.converter = converter;
@@ -308,7 +317,7 @@ public void onMessage(org.springframework.amqp.core.Message message) {
308317
}
309318
}
310319

311-
protected Message<Object> buildMessage(org.springframework.amqp.core.Message message, Object converted) {
320+
private Message<Object> buildMessage(org.springframework.amqp.core.Message message, Object converted) {
312321
AbstractIntegrationMessageBuilder<Object> messageBuilder =
313322
this.messageBuilderFactory.withPayload(converted);
314323
if (this.channel.isExtractPayload()) {

0 commit comments

Comments
 (0)