Skip to content

Commit ed544de

Browse files
committed
Fix deprecation warnings in AMPQ module
* The `Confirm` in Spring AMQP is a `record` now, so not `isAck()` but just `ack()` * The `MessageBatch` in Spring AMQP is a `record` now, so not `getMessage()`, but just `message()` * Fix new deprecation warning for the `SingleRequestResponseScenarioTests`
1 parent f4e7763 commit ed544de

File tree

12 files changed

+20
-20
lines changed

12 files changed

+20
-20
lines changed

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AbstractMessageListenerContainerSpec.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2023 the original author or authors.
2+
* Copyright 2017-2025 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.
@@ -20,6 +20,7 @@
2020
import java.util.concurrent.Executor;
2121

2222
import org.aopalliance.aop.Advice;
23+
import org.jspecify.annotations.Nullable;
2324

2425
import org.springframework.amqp.core.AcknowledgeMode;
2526
import org.springframework.amqp.core.MessagePostProcessor;
@@ -55,7 +56,7 @@ public AbstractMessageListenerContainerSpec(C listenerContainer) {
5556
}
5657

5758
@Override
58-
public S id(String id) { // NOSONAR - not useless, increases visibility
59+
public S id(@Nullable String id) { // NOSONAR - not useless, increases visibility
5960
return super.id(id);
6061
}
6162

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
22
* Provides AMQP Component support for the Java DSL.
33
*/
4-
@org.springframework.lang.NonNullApi
4+
@org.jspecify.annotations.NullMarked
55
package org.springframework.integration.amqp.dsl;

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private void waitForConfirm(Message<?> requestMessage, CorrelationData correlati
208208
try {
209209
Confirm confirm = correlationData.getFuture().get(this.waitForConfirmTimeout.toMillis(),
210210
TimeUnit.MILLISECONDS);
211-
if (!confirm.isAck()) {
211+
if (!confirm.ack()) {
212212
throw new AmqpException("Negative publisher confirm received: " + confirm);
213213
}
214214
if (correlationData.getReturned() != null) {

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/package-info.java

Lines changed: 0 additions & 5 deletions
This file was deleted.

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/inbound/InboundEndpointTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2024 the original author or authors.
2+
* Copyright 2013-2025 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.
@@ -477,7 +477,7 @@ public void testBatchAdapter() throws Exception {
477477
bs.addToBatch("foo", "bar", message);
478478
message = new org.springframework.amqp.core.Message("test2".getBytes(), messageProperties);
479479
MessageBatch batched = bs.addToBatch("foo", "bar", message);
480-
listener.onMessage(batched.getMessage(), null);
480+
listener.onMessage(batched.message(), null);
481481
Message<?> received = out.receive(0);
482482
assertThat(received).isNotNull();
483483
assertThat(((List<String>) received.getPayload())).contains("test1", "test2");
@@ -503,12 +503,12 @@ public void testBatchGateway() throws Exception {
503503
bs.addToBatch("foo", "bar", message);
504504
message = new org.springframework.amqp.core.Message("test2".getBytes(), messageProperties);
505505
MessageBatch batched = bs.addToBatch("foo", "bar", message);
506-
listener.onMessage(batched.getMessage(), null);
506+
listener.onMessage(batched.message(), null);
507507
Message<?> received = out.receive(0);
508508
assertThat(received).isNotNull();
509509
assertThat(((List<String>) received.getPayload())).contains("test1", "test2");
510510
org.springframework.amqp.core.Message sourceData = StaticMessageHeaderAccessor.getSourceData(received);
511-
assertThat(sourceData).isSameAs(batched.getMessage());
511+
assertThat(sourceData).isSameAs(batched.message());
512512
}
513513

514514
@SuppressWarnings({"unchecked"})

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java

Lines changed: 2 additions & 2 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-2025 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.
@@ -229,7 +229,7 @@ public void adapterWithReturns() throws Exception {
229229
assertThat(returned.getPayload()).isEqualTo(message.getPayload());
230230
Confirm confirm = corrData.getFuture().get(10, TimeUnit.SECONDS);
231231
assertThat(confirm).isNotNull();
232-
assertThat(confirm.isAck()).isTrue();
232+
assertThat(confirm.ack()).isTrue();
233233
assertThat(corrData.getReturned()).isNotNull();
234234
}
235235

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests2.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 the original author or authors.
2+
* Copyright 2019-2025 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.
@@ -84,7 +84,7 @@ void testReturnConfirmNoChannels(@Autowired IntegrationFlow flow2) throws Except
8484
.setHeader("rk", "junkjunk")
8585
.setHeader(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION, corr)
8686
.build());
87-
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).isAck()).isTrue();
87+
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).ack()).isTrue();
8888
assertThat(corr.getReturned()).isNotNull();
8989
}
9090

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AsyncAmqpGatewayTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2022 the original author or authors.
2+
* Copyright 2016-2025 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.
@@ -251,7 +251,7 @@ void confirmsAndReturnsNoChannels() throws Exception {
251251
gateway.handleMessage(MessageBuilder.withPayload("test")
252252
.setHeader(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION, corr)
253253
.build());
254-
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).isAck()).isTrue();
254+
assertThat(corr.getFuture().get(10, TimeUnit.SECONDS).ack()).isTrue();
255255
assertThat(corr.getReturned()).isNotNull();
256256

257257
asyncTemplate.stop();

spring-integration-test-support/src/main/java/org/springframework/integration/test/support/AbstractRequestResponseScenarioTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
* @author Gary Russell
4848
* @author Artem Bilan
4949
* @author Jiandong Ma
50+
*
51+
* @since 7.0
5052
*/
5153
@SpringJUnitConfig
5254
@DirtiesContext

spring-integration-test-support/src/main/java/org/springframework/integration/test/support/LongRunningIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.springframework.integration.test.condition.LongRunningTest;
2727

2828
/**
29-
* Rule to prevent long running tests from running on every build; set environment
29+
* Rule to prevent long-running tests from running on every build; set environment
3030
* variable RUN_LONG_INTEGRATION_TESTS on a CI nightly build to ensure coverage.
3131
*
3232
* @author Gary Russell

0 commit comments

Comments
 (0)