@@ -44,7 +44,6 @@ import reactor.util.function.Tuples;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
@@ -144,11 +143,6 @@ public class FunctionConfiguration {
|
||||
return new FunctionBindingRegistrar(functionCatalog, streamFunctionProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SmartInitializingSingleton po(GenericApplicationContext context) {
|
||||
return new PollableSourceRegistrar(context);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InitializingBean functionInitializer(FunctionCatalog functionCatalog,
|
||||
StreamFunctionProperties functionProperties,
|
||||
@@ -801,34 +795,6 @@ public class FunctionConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
private static class PollableSourceRegistrar implements SmartInitializingSingleton {
|
||||
private final Environment environment;
|
||||
|
||||
private final GenericApplicationContext context;
|
||||
|
||||
PollableSourceRegistrar(GenericApplicationContext context) {
|
||||
this.environment = context.getEnvironment();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSingletonsInstantiated() {
|
||||
if (StringUtils.hasText(this.environment.getProperty("spring.cloud.stream.pollable-source"))) {
|
||||
String[] sourceNames = this.environment.getProperty("spring.cloud.stream.pollable-source").split(";");
|
||||
|
||||
for (String sourceName : sourceNames) {
|
||||
final SupportedBindableFeatures supportedBindableFeatures = new SupportedBindableFeatures();
|
||||
supportedBindableFeatures.setPollable(true);
|
||||
supportedBindableFeatures.setReactive(false);
|
||||
|
||||
BindableFunctionProxyFactory proxyFactory =
|
||||
new BindableFunctionProxyFactory(sourceName, 1, 0, new StreamFunctionProperties(), supportedBindableFeatures);
|
||||
context.registerBean(sourceName + "_binding", BindableFunctionProxyFactory.class, () -> proxyFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and registers instances of BindableFunctionProxyFactory for each user defined function
|
||||
* thus triggering destination bindings between function arguments and destinations.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
org.springframework.boot.env.EnvironmentPostProcessor:\
|
||||
org.springframework.cloud.stream.function.RoutingFunctionEnvironmentPostProcessor,\
|
||||
org.springframework.cloud.stream.config.PollerConfigEnvironmentPostProcessor
|
||||
org.springframework.context.ApplicationContextInitializer:\
|
||||
org.springframework.cloud.stream.function.PollableSourceInitializer
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user