GH-3086 Fix naming for explicit bindings that are not backed by a function

This commit is contained in:
Oleg Zhurakousky
2025-04-15 15:02:27 +02:00
parent 143ac8208a
commit 27c68b267b
3 changed files with 8 additions and 6 deletions

View File

@@ -89,9 +89,9 @@ public class BindingsLifecycleController implements ApplicationContextAware {
*/
public <P> P defineInputBinding(String bindingName) {
BindableFunctionProxyFactory bindingProxyFactory =
new BindableFunctionProxyFactory(bindingName, 1, 0, this.applicationContext.getBean(StreamFunctionProperties.class));
new BindableFunctionProxyFactory(bindingName, 1, 0, this.applicationContext.getBean(StreamFunctionProperties.class), false);
this.defineBinding(bindingProxyFactory);
return this.getExtensionProperties(bindingName + "-in-0");
return this.getExtensionProperties(bindingName);
}
/**
@@ -102,9 +102,9 @@ public class BindingsLifecycleController implements ApplicationContextAware {
*/
public <P> P defineOutputBinding(String bindingName) {
BindableFunctionProxyFactory bindingProxyFactory =
new BindableFunctionProxyFactory(bindingName, 0, 1, this.applicationContext.getBean(StreamFunctionProperties.class));
new BindableFunctionProxyFactory(bindingName, 0, 1, this.applicationContext.getBean(StreamFunctionProperties.class), false);
this.defineBinding(bindingProxyFactory);
return this.getExtensionProperties(bindingName + "-out-0");
return this.getExtensionProperties(bindingName);
}
/**

View File

@@ -77,7 +77,7 @@ public class BindableFunctionProxyFactory extends BindableProxyFactory implement
this(functionDefinition, inputCount, outputCount, functionProperties, new SupportedBindableFeatures(), true);
}
BindableFunctionProxyFactory(String functionDefinition, int inputCount, int outputCount, StreamFunctionProperties functionProperties, boolean functionExist) {
public BindableFunctionProxyFactory(String functionDefinition, int inputCount, int outputCount, StreamFunctionProperties functionProperties, boolean functionExist) {
this(functionDefinition, inputCount, outputCount, functionProperties, new SupportedBindableFeatures(), functionExist);
}

View File

@@ -42,10 +42,12 @@ You can than manage its properties by calling `getExtensionProperties(..)` metho
[source,java]
----
KafkaConsumerProperties properties = controller.getExtensionProperties("test-input-binding-in-0”);
KafkaConsumerProperties properties = controller.getExtensionProperties("test-input-binding”);
----
NOTE: Unlike binding names derived from function definition, explicitly defined bindings do not carry the `in-0/out-0` suffix since they are not backed by an actual function.
The `getExtensionProperties(..)` operation is defined to ensure you get the proper type of the configuration properties class, so depending on the binder and binding used you can safely cast your extension properties to appropriate type. In our case it is `KafkaConsumerProperties` properties.
NOTE: Depending on the type of property you change, you may need to re-start the binding for it to take effect (ass seen earlier)