Small cleanup in StreamBridge

Remove redundant injection of FunctionRegistry since it is the same as FunctionCatalog
This commit is contained in:
Oleg Zhurakousky
2022-08-29 16:51:42 +02:00
parent 92ea029a8b
commit ccc26f8863
2 changed files with 6 additions and 15 deletions

View File

@@ -134,10 +134,10 @@ public class FunctionConfiguration {
@SuppressWarnings("rawtypes")
@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

View File

@@ -84,8 +84,6 @@ public final class StreamBridge implements SmartInitializingSingleton {
private final FunctionCatalog functionCatalog;
private final FunctionRegistry functionRegistry;
private final NewDestinationBindingCallback destinationBindingCallback;
private BindingServiceProperties bindingServiceProperties;
@@ -103,17 +101,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;
@@ -260,14 +255,10 @@ public final class StreamBridge implements SmartInitializingSingleton {
FunctionRegistration<Function<Object, Object>> fr = new FunctionRegistration<>(new PassThruFunction(), STREAM_BRIDGE_FUNC_NAME);
fr.getProperties().put("singleton", "false");
Type functionType = ResolvableType.forClassWithGenerics(Function.class, Object.class, Object.class).getType();
this.functionRegistry.register(fr.type(functionType));
((FunctionRegistry) this.functionCatalog).register(fr.type(functionType));
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;
}