INT-4332 updated DSL with Supplier support
- add support for Supplier as sources of messages to the DSL - add tests and javadocs
This commit is contained in:
committed by
Gary Russell
parent
946cc229eb
commit
318741d1fd
@@ -17,6 +17,7 @@
|
||||
package org.springframework.integration.dsl;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
@@ -28,6 +29,7 @@ import org.springframework.integration.dsl.support.FixedSubscriberChannelPrototy
|
||||
import org.springframework.integration.dsl.support.MessageChannelReference;
|
||||
import org.springframework.integration.endpoint.MessageProducerSupport;
|
||||
import org.springframework.integration.endpoint.MethodInvokingMessageSource;
|
||||
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
|
||||
import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean;
|
||||
import org.springframework.integration.gateway.GatewayProxyFactoryBean;
|
||||
import org.springframework.integration.gateway.MessagingGatewaySupport;
|
||||
@@ -40,6 +42,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
* @since 5.0
|
||||
*
|
||||
@@ -146,6 +149,30 @@ public final class IntegrationFlows {
|
||||
return from(service, methodName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides {@link Supplier} as source of messages to the integration flow which will
|
||||
* be triggered by the application context's default poller (which must be declared).
|
||||
* @param messageSource the {@link Supplier} to populate.
|
||||
* @return new {@link IntegrationFlowBuilder}.
|
||||
* @see Supplier
|
||||
*/
|
||||
public static <T> IntegrationFlowBuilder from(Supplier<T> messageSource) {
|
||||
return from(messageSource, "get", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides {@link Supplier} as source of messages to the integration flow.
|
||||
* which will be triggered by a <b>provided</b> {@link SourcePollingChannelAdapter}.
|
||||
* @param messageSource the {@link Supplier} to populate.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide more options for the
|
||||
* {@link org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean}.
|
||||
* @return new {@link IntegrationFlowBuilder}.
|
||||
* @see Supplier
|
||||
*/
|
||||
public static <T> IntegrationFlowBuilder from(Supplier<T> messageSource, Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer) {
|
||||
return from(messageSource, "get", endpointConfigurer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the provided {@link MethodInvokingMessageSource} for the method of the provided service.
|
||||
* The {@link org.springframework.integration.dsl.IntegrationFlow} {@code startMessageSource}.
|
||||
|
||||
Reference in New Issue
Block a user