Skip to content

Commit 9be9e63

Browse files
committed
Upgrade to Spring AMQP 2.1 M2
* Add `@SuppressWarnings("serial")` for the `RequestMessageHolder` * Use non-caching JMS CF for the Inbound endpoints in the `JmsTests` * Make `AsyncGatewayTests extends ActiveMQMultiContextTests` to keep embedded broker opened in between test methods
1 parent 0f27a9f commit 9be9e63

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ subprojects { subproject ->
131131
romeToolsVersion = '1.9.0'
132132
servletApiVersion = '4.0.0'
133133
smackVersion = '4.2.3'
134-
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.1.0.BUILD-SNAPSHOT'
134+
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.1.0.M2'
135135
springDataJpaVersion = '2.1.0.RC2'
136136
springDataMongoVersion = '2.1.0.RC2'
137137
springDataRedisVersion = '2.1.0.RC2'

spring-integration-core/src/main/java/org/springframework/integration/dsl/Transformers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ static <I, O> Flux<Message<O>> transformWithFunction(Publisher<Message<I>> publi
294294
.subscriberContext(ctx -> ctx.put(RequestMessageHolder.class, new RequestMessageHolder()));
295295
}
296296

297+
298+
@SuppressWarnings("serial")
297299
private static class RequestMessageHolder extends AtomicReference<Message<?>> {
298300

299301
}

spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void testJmsOutboundInboundFlow() {
176176
JmsTemplate jmsTemplate =
177177
TestUtils.getPropertyValue(this.jmsDestinationPollingSource, "jmsTemplate", JmsTemplate.class);
178178

179-
assertEquals(JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT, jmsTemplate.getReceiveTimeout());
179+
assertEquals(1000, jmsTemplate.getReceiveTimeout());
180180

181181
this.jmsOutboundInboundChannel.send(MessageBuilder.withPayload("hello THROUGH the JMS")
182182
.setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "jmsInbound")
@@ -307,7 +307,7 @@ public IntegrationFlow flow1() {
307307
return f -> f
308308
.fixedSubscriberChannel("integerChannel")
309309
.transform("payload.toString()")
310-
.channel(Jms.pollableChannel("flow1QueueChannel", cachingConnectionFactory())
310+
.channel(Jms.pollableChannel("flow1QueueChannel", jmsConnectionFactory())
311311
.destination("flow1QueueChannel"));
312312
}
313313

@@ -327,7 +327,7 @@ public MessageChannel jmsOutboundInboundReplyChannel() {
327327
@Bean
328328
public IntegrationFlow jmsInboundFlow() {
329329
return IntegrationFlows
330-
.from(Jms.inboundAdapter(cachingConnectionFactory()).destination("jmsInbound"))
330+
.from(Jms.inboundAdapter(jmsConnectionFactory()).destination("jmsInbound"))
331331
.<String, String>transform(String::toUpperCase)
332332
.channel(this.jmsOutboundInboundReplyChannel())
333333
.get();
@@ -336,7 +336,7 @@ public IntegrationFlow jmsInboundFlow() {
336336
@Bean
337337
public IntegrationFlow pubSubFlow() {
338338
return IntegrationFlows
339-
.from(Jms.publishSubscribeChannel(cachingConnectionFactory())
339+
.from(Jms.publishSubscribeChannel(jmsConnectionFactory())
340340
.destination("pubsub"))
341341
.channel(c -> c.queue("jmsPubSubBridgeChannel"))
342342
.get();
@@ -430,7 +430,7 @@ public Message<?> preSend(Message<?> message, MessageChannel channel) {
430430
@Bean
431431
public IntegrationFlow jmsMessageDrivenRedeliveryFlow() {
432432
return IntegrationFlows
433-
.from(Jms.messageDrivenChannelAdapter(cachingConnectionFactory())
433+
.from(Jms.messageDrivenChannelAdapter(jmsConnectionFactory())
434434
.errorChannel(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME)
435435
.destination("jmsMessageDrivenRedelivery")
436436
.configureListenerContainer(c -> c

spring-integration-jms/src/test/java/org/springframework/integration/jms/request_reply/AsyncGatewayTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2016-2018 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.
@@ -34,6 +34,7 @@
3434
import org.springframework.context.annotation.Configuration;
3535
import org.springframework.integration.channel.QueueChannel;
3636
import org.springframework.integration.config.EnableIntegration;
37+
import org.springframework.integration.jms.ActiveMQMultiContextTests;
3738
import org.springframework.integration.jms.JmsOutboundGateway;
3839
import org.springframework.integration.jms.JmsTimeoutException;
3940
import org.springframework.jms.connection.CachingConnectionFactory;
@@ -49,13 +50,15 @@
4950

5051
/**
5152
* @author Gary Russell
53+
* @author Artem Bilan
54+
*
5255
* @since 4.3
5356
*
5457
*/
5558
@ContextConfiguration
5659
@RunWith(SpringJUnit4ClassRunner.class)
5760
@DirtiesContext
58-
public class AsyncGatewayTests {
61+
public class AsyncGatewayTests extends ActiveMQMultiContextTests {
5962

6063
@Autowired
6164
private CachingConnectionFactory ccf;

0 commit comments

Comments
 (0)