Small cleanup in StreamBridge
Remove redundant injection of FunctionRegistry since it is the same as FunctionCatalog
This commit is contained in:
@@ -137,10 +137,10 @@ public class FunctionConfiguration {
|
||||
private final static String SOURCE_PROPERY = "spring.cloud.stream.source";
|
||||
|
||||
@Bean
|
||||
public StreamBridge streamBridgeUtils(FunctionCatalog functionCatalog, FunctionRegistry functionRegistry,
|
||||
public StreamBridge streamBridgeUtils(FunctionCatalog functionCatalog,
|
||||
BindingServiceProperties bindingServiceProperties, ConfigurableApplicationContext applicationContext,
|
||||
@Nullable NewDestinationBindingCallback callback) {
|
||||
return new StreamBridge(functionCatalog, functionRegistry, bindingServiceProperties, applicationContext, callback);
|
||||
return new StreamBridge(functionCatalog, bindingServiceProperties, applicationContext, callback);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -82,8 +82,6 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
|
||||
private final FunctionCatalog functionCatalog;
|
||||
|
||||
private final FunctionRegistry functionRegistry;
|
||||
|
||||
private final NewDestinationBindingCallback destinationBindingCallback;
|
||||
|
||||
private BindingServiceProperties bindingServiceProperties;
|
||||
@@ -101,17 +99,14 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
/**
|
||||
*
|
||||
* @param functionCatalog instance of {@link FunctionCatalog}
|
||||
* @param functionRegistry instance of {@link FunctionRegistry}
|
||||
* @param bindingServiceProperties instance of {@link BindingServiceProperties}
|
||||
* @param applicationContext instance of {@link ConfigurableApplicationContext}
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
StreamBridge(FunctionCatalog functionCatalog, FunctionRegistry functionRegistry,
|
||||
BindingServiceProperties bindingServiceProperties, ConfigurableApplicationContext applicationContext,
|
||||
@Nullable NewDestinationBindingCallback destinationBindingCallback) {
|
||||
StreamBridge(FunctionCatalog functionCatalog, BindingServiceProperties bindingServiceProperties,
|
||||
ConfigurableApplicationContext applicationContext, @Nullable NewDestinationBindingCallback destinationBindingCallback) {
|
||||
this.bindingService = applicationContext.getBean(BindingService.class);
|
||||
this.functionCatalog = functionCatalog;
|
||||
this.functionRegistry = functionRegistry;
|
||||
this.applicationContext = applicationContext;
|
||||
this.bindingServiceProperties = bindingServiceProperties;
|
||||
this.destinationBindingCallback = destinationBindingCallback;
|
||||
@@ -257,13 +252,8 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
}
|
||||
FunctionRegistration<Function<Object, Object>> fr = new FunctionRegistration<>(v -> v, STREAM_BRIDGE_FUNC_NAME);
|
||||
fr.getProperties().put("singleton", "false");
|
||||
this.functionRegistry.register(fr.type(FunctionType.from(Object.class).to(Object.class).message()));
|
||||
((FunctionRegistry) this.functionCatalog).register(fr.type(FunctionType.from(Object.class).to(Object.class).message()));
|
||||
Map<String, DirectWithAttributesChannel> channels = applicationContext.getBeansOfType(DirectWithAttributesChannel.class);
|
||||
// for (Entry<String, DirectWithAttributesChannel> channelEntry : channels.entrySet()) {
|
||||
// if (channelEntry.getValue().getAttribute("type").equals("output")) {
|
||||
// this.channelCache.put(channelEntry.getKey(), channelEntry.getValue());
|
||||
// }
|
||||
// }
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user