Fix previous commit

This commit is contained in:
Oleg Zhurakousky
2021-07-28 12:39:42 +02:00
parent e3b3cd9c66
commit 1b091f7772
2 changed files with 13 additions and 13 deletions

View File

@@ -87,20 +87,18 @@ public class TraceFunctionAroundWrapper extends FunctionAroundWrapper
protected Object doApply(Message<byte[]> message, SimpleFunctionRegistry.FunctionInvocationWrapper targetFunction) {
/*
* This code is temporary to disable conditions for which this interceptor is not ready.
* For example,
* - it does not handle properly input or output of type Publisher
* - it wraps output in Message when function returns a Collection<Message> which it should not do.
* This code is temporary to disable conditions for which this interceptor is not
* ready. For example, - it does not handle properly input or output of type
* Publisher - it wraps output in Message when function returns a
* Collection<Message> which it should not do.
*
*/
if ( (!FunctionTypeUtils.isCollectionOfMessage(targetFunction.getOutputType()) && !targetFunction.isOutputTypePublisher())
|| (targetFunction.isSupplier() && !targetFunction.isOutputTypePublisher())
) {
return targetFunction.apply(message); // no instrumentation
if ((FunctionTypeUtils.isCollectionOfMessage(targetFunction.getOutputType())
|| targetFunction.isOutputTypePublisher())
|| (targetFunction.isSupplier() && targetFunction.isOutputTypePublisher())) {
return targetFunction.apply(message); // no instrumentation
}
MessageAndSpans invocationMessage = null;
Span span;
if (message == null && targetFunction.isSupplier()) { // Supplier

View File

@@ -74,9 +74,11 @@ public abstract class TraceFunctionAroundWrapperTests {
function.setSkipOutputConversion(true);
Object result = function.get();
assertThat(result).isInstanceOf(Publisher.class);
/* TODO
* We'll need more assertions but for now this one will ensure that wrapper does not change the type of return value
* specifically for reactive cases where Flux became Message<Flux> due to the current code in TraceFunctionAroundWrapper
/*
* TODO We'll need more assertions but for now this one will ensure that
* wrapper does not change the type of return value specifically for reactive
* cases where Flux became Message<Flux> due to the current code in
* TraceFunctionAroundWrapper
*/
}
}