Skip to content

Commit 0af3b25

Browse files
committed
GH-9863: Deprecate PollerMetadata.sendTimeout option
Fixes: #9863 Issue link: #9863 The `PollerMetadata.sendTimeout` has been migrated to the `SourcePollingChannelAdapter.setSendTimeout()` long time ago. Right now this option is not propagated anywhere * Introduce missed `SourcePollingChannelAdapterSpec.sendTimeout` * Deprecate (for removal) `PollerMetadata.sendTimeout` * Verify `SourcePollingChannelAdapterSpec.sendTimeout` option in the `ReactiveStreamsTests` **Auto-cherry-pick to `6.4.x` & `6.3.x`**
1 parent 478d6b1 commit 0af3b25

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2020 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.
@@ -189,8 +189,14 @@ public PollerSpec taskExecutor(Executor taskExecutor) {
189189
return this;
190190
}
191191

192+
/**
193+
* The timeout for blocking send on channels.
194+
* @param sendTimeout the timeout to use.
195+
* @return the spec.
196+
* @deprecated in favor of {@link SourcePollingChannelAdapterSpec#sendTimeout(long)}
197+
*/
198+
@Deprecated(forRemoval = true, since = "6.3.9")
192199
public PollerSpec sendTimeout(long sendTimeout) {
193-
this.target.setSendTimeout(sendTimeout);
194200
return this;
195201
}
196202

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 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.
@@ -72,4 +72,15 @@ public SourcePollingChannelAdapterSpec taskScheduler(TaskScheduler taskScheduler
7272
return this;
7373
}
7474

75+
/**
76+
* The timeout for blocking send on channels.
77+
* @param sendTimeout the timeout to use.
78+
* @return the spec.
79+
* @since 6.3.9
80+
*/
81+
public SourcePollingChannelAdapterSpec sendTimeout(long sendTimeout) {
82+
this.endpointFactoryBean.setSendTimeout(sendTimeout);
83+
return this;
84+
}
85+
7586
}

spring-integration-core/src/main/java/org/springframework/integration/scheduling/PollerMetadata.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 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.
@@ -138,10 +138,12 @@ public Executor getTaskExecutor() {
138138
return this.taskExecutor;
139139
}
140140

141+
@Deprecated(forRemoval = true, since = "6.3.9")
141142
public long getSendTimeout() {
142143
return this.sendTimeout;
143144
}
144145

146+
@Deprecated(forRemoval = true, since = "6.3.9")
145147
public void setSendTimeout(long sendTimeout) {
146148
this.sendTimeout = sendTimeout;
147149
}

spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 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.
@@ -52,6 +52,7 @@
5252
import org.springframework.integration.endpoint.MessageProducerSupport;
5353
import org.springframework.integration.endpoint.ReactiveMessageSourceProducer;
5454
import org.springframework.integration.endpoint.ReactiveStreamsConsumer;
55+
import org.springframework.integration.test.util.TestUtils;
5556
import org.springframework.messaging.Message;
5657
import org.springframework.messaging.MessageChannel;
5758
import org.springframework.messaging.support.GenericMessage;
@@ -122,6 +123,7 @@ void testReactiveFlow() throws Exception {
122123

123124
disposable.dispose();
124125
assertThat(this.messageSource.isRunning()).isFalse();
126+
assertThat(TestUtils.getPropertyValue(this.messageSource, "messagingTemplate.sendTimeout")).isEqualTo(256L);
125127
}
126128

127129
@Test
@@ -275,6 +277,7 @@ public Publisher<Message<String>> reactiveFlow() {
275277
return IntegrationFlow
276278
.from(() -> new GenericMessage<>("a,b,c,d,e,f"),
277279
e -> e.poller(p -> p.trigger(ctx -> this.invoked.getAndSet(true) ? null : Instant.now()))
280+
.sendTimeout(256)
278281
.id("reactiveStreamsMessageSource"))
279282
.split(String.class, p -> p.split(","))
280283
.log()

0 commit comments

Comments
 (0)