Skip to content

Commit

Permalink
remove set properties for functional bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoDiGiuseppe committed Jan 25, 2023
1 parent cac897a commit dc80d97
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.function.context.FunctionRegistry;
import org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry.FunctionInvocationWrapper;
import org.springframework.cloud.stream.config.BindingProperties;
import org.springframework.cloud.stream.config.BindingServiceProperties;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.cloud.stream.function.StreamFunctionProperties;
Expand Down Expand Up @@ -77,7 +76,6 @@ protected boolean setOutput(String beanOutName, String outputAnnotation, Binding
.filter(StringUtils::hasText)
.ifPresent(output -> {
streamFunctionProperties.getBindings().put(beanOutName, output);
setOutProperties(streamFunctionProperties, beanOutName, output, bindingServiceProperties);
wasOutputSet.set(true);
});
return wasOutputSet.get();
Expand All @@ -91,36 +89,11 @@ protected boolean setInput(String beanInName, String inputAnnotation, StreamFunc
.filter(StringUtils::hasText)
.ifPresent(input -> {
streamFunctionProperties.getBindings().put(beanInName, input);
setInProperties(streamFunctionProperties, beanInName, input, bindingServiceProperties);
wasInputSet.set(true);
});
return wasInputSet.get();
}

protected void setOutProperties(StreamFunctionProperties streamFunctionProperties,
String beanOutName,
String binding,
BindingServiceProperties bindingServiceProperties) {

Optional.ofNullable(bindingServiceProperties.getProducerProperties(binding))
.ifPresent(producerProperties -> {
bindingServiceProperties.getBindingProperties(beanOutName).setProducer(producerProperties);
});
}

protected void setInProperties(StreamFunctionProperties streamFunctionProperties,
String beanInName,
String binding,
BindingServiceProperties bindingServiceProperties) {

Optional.ofNullable(bindingServiceProperties.getBindingProperties(binding))
.ifPresent(bindingProperties -> {
bindingServiceProperties.getBindings().putIfAbsent(beanInName, new BindingProperties());
bindingServiceProperties.getBindingProperties(beanInName).setDestination(binding);
bindingServiceProperties.getBindingProperties(beanInName).setContentType(bindingProperties.getContentType());
});
}

protected Class<?> getGatewayInterface(boolean hasOutput) {
if(hasOutput) {
return ConnectorGateway.class;
Expand Down

0 comments on commit dc80d97

Please sign in to comment.