GH-SCST-2235 Fix Partitioning issue with FunctionAroundWrapper"
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
package org.springframework.cloud.function.grpc;
|
||||||
|
|
||||||
|
public class GrpcClientTemplate {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,13 +37,20 @@ public abstract class FunctionAroundWrapper implements BiFunction<Object, Functi
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
|
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
|
||||||
|
boolean isSkipOutputConversion = targetFunction.isSkipOutputConversion();
|
||||||
|
targetFunction.setSkipOutputConversion(true);
|
||||||
|
Object result = null;
|
||||||
if (input instanceof Message) {
|
if (input instanceof Message) {
|
||||||
return this.doApply((Message<byte[]>) input, targetFunction);
|
result = this.doApply((Message<byte[]>) input, targetFunction);
|
||||||
}
|
}
|
||||||
else if (targetFunction.isSupplier() && !targetFunction.isOutputTypePublisher()) {
|
else if (targetFunction.isSupplier() && !targetFunction.isOutputTypePublisher()) {
|
||||||
return this.doApply(null, targetFunction);
|
result = this.doApply(null, targetFunction);
|
||||||
}
|
}
|
||||||
return targetFunction.apply(input);
|
else {
|
||||||
|
result = targetFunction.apply(input);
|
||||||
|
}
|
||||||
|
targetFunction.setSkipOutputConversion(isSkipOutputConversion);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Object doApply(Message<byte[]> input, FunctionInvocationWrapper targetFunction);
|
protected abstract Object doApply(Message<byte[]> input, FunctionInvocationWrapper targetFunction);
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
|||||||
private Function<Object, Object> enhancer;
|
private Function<Object, Object> enhancer;
|
||||||
|
|
||||||
FunctionInvocationWrapper(FunctionInvocationWrapper function) {
|
FunctionInvocationWrapper(FunctionInvocationWrapper function) {
|
||||||
|
this.expectedOutputContentType = function.expectedOutputContentType;
|
||||||
this.skipOutputConversion = function.skipOutputConversion;
|
this.skipOutputConversion = function.skipOutputConversion;
|
||||||
this.skipInputConversion = function.skipInputConversion;
|
this.skipInputConversion = function.skipInputConversion;
|
||||||
this.target = function.target;
|
this.target = function.target;
|
||||||
@@ -407,6 +408,11 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
|||||||
this.message = this.inputType != null && FunctionTypeUtils.isMessage(this.inputType);
|
this.message = this.inputType != null && FunctionTypeUtils.isMessage(this.inputType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSkipOutputConversion() {
|
||||||
|
return skipOutputConversion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isPrototype() {
|
public boolean isPrototype() {
|
||||||
return this.isPrototype();
|
return this.isPrototype();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>2.8.2</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<skip>true</skip>
|
<skip>true</skip>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
Reference in New Issue
Block a user