Fix SourcePollingChAdFB autoStartup propagation
The `spring.integration.properties` can come with the `noAutoStartup` property where we can specify a source polling channel adapter endpoint to not start automatically. Turns out the `SourcePollingChannelAdapterFactoryBean` propagates its `autoStartup` property unconditionally which will skip the `noAutoStartup` value because an `AbstractEndpoint.setAutoStartup()` sets an `autoStartupSetExplicitly` state * Fix `SourcePollingChannelAdapterFactoryBean` to rely on a `Boolean` object state and don't call target endpoint `setAutoStartup()` if it was not set * Adjust `spring.integration.properties` in tests to use `noAutoStartup` for some `SourcePollingChannelAdapterFactoryBean` * Verify that property was applied in the `IntegrationFlowTests.testWithSupplierMessageSourceImpliedPoller()` **Cherry-pick to `5.4.x` & `5.3.x`**
This commit is contained in:
committed by
Gary Russell
parent
db4f120dac
commit
a5776524e2
@@ -64,6 +64,7 @@ import org.springframework.integration.dsl.IntegrationFlows;
|
||||
import org.springframework.integration.dsl.MessageChannels;
|
||||
import org.springframework.integration.dsl.Pollers;
|
||||
import org.springframework.integration.dsl.Transformers;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.endpoint.EventDrivenConsumer;
|
||||
import org.springframework.integration.gateway.GatewayProxyFactoryBean;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
@@ -180,8 +181,14 @@ public class IntegrationFlowTests {
|
||||
@Qualifier("lambdasInput")
|
||||
private MessageChannel lambdasInput;
|
||||
|
||||
@Autowired
|
||||
AbstractEndpoint stringSupplierEndpoint;
|
||||
|
||||
@Test
|
||||
public void testWithSupplierMessageSourceImpliedPoller() {
|
||||
assertThat(this.stringSupplierEndpoint.isAutoStartup()).isFalse();
|
||||
assertThat(this.stringSupplierEndpoint.isRunning()).isFalse();
|
||||
this.stringSupplierEndpoint.start();
|
||||
assertThat(this.suppliedChannel.receive(10000).getPayload()).isEqualTo("FOO");
|
||||
}
|
||||
|
||||
@@ -563,7 +570,7 @@ public class IntegrationFlowTests {
|
||||
|
||||
@Bean
|
||||
public IntegrationFlow supplierFlow() {
|
||||
return IntegrationFlows.fromSupplier(stringSupplier())
|
||||
return IntegrationFlows.fromSupplier(stringSupplier(), c -> c.id("stringSupplierEndpoint"))
|
||||
.transform(toUpperCaseFunction())
|
||||
.channel("suppliedChannel")
|
||||
.get();
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
#spring.integration.channels.maxBroadcastSubscribers=1
|
||||
spring.integration.taskScheduler.poolSize=20
|
||||
spring.integration.messagingTemplate.throwExceptionOnLateReply=true
|
||||
spring.integration.endpoints.noAutoStartup=fooService*
|
||||
spring.integration.endpoints.noAutoStartup=fooService*,stringSupplierEndpoint
|
||||
|
||||
Reference in New Issue
Block a user