Inject LOOKUP_DESTINATION_HEADER if definition property is not used

This commit is contained in:
Oleg Zhurakousky
2020-09-15 13:51:49 +02:00
parent 2dffa30669
commit a4763ee879
4 changed files with 52 additions and 4 deletions

View File

@@ -43,6 +43,12 @@ public class FunctionProperties {
*/
private String definition;
private String contentType = "application/json";
private String accept = "application/json";
/**
* SpEL expression which should result in function definition (e.g., function name or composition instruction).
* NOTE: SpEL evaluation context's root object is the input argument (e.g., Message).
@@ -64,4 +70,20 @@ public class FunctionProperties {
public void setRoutingExpression(String routingExpression) {
this.routingExpression = routingExpression;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getAccept() {
return accept;
}
public void setAccept(String accept) {
this.accept = accept;
}
}

View File

@@ -173,6 +173,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
if (this.functionAroundWrapper != null && function != null) {
return (T) new FunctionInvocationWrapper(function) {
@SuppressWarnings("rawtypes")
@Override
Object doApply(Object input, boolean consumer, Function<Message, Message> enricher) {
return functionAroundWrapper.apply(input, function);
@@ -805,7 +806,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
// this needs revisiting as the type is not always Class (think really complex types)
Type rawType = FunctionTypeUtils.unwrapActualTypeByIndex(type, 0);
if (logger.isDebugEnabled()) {
logger.debug("Raw type of value: " + value + "is " + rawType);
logger.debug("Raw type of value: " + value + " is " + rawType);
}
if (rawType instanceof ParameterizedType) {