This question pertains directly to another question: Spring-Integration AbstractRequestHandlerAdvice with webflux/reactive: does this introduce a synchronous process?
The return result retrieved by the call from the advice handler to an http:outbound-gateway is either a Message<?> or a MessageBuilder (or perhaps only the latter).
public class MyLogger extends AbstractRequestHandlerAdvice {
// ...
@Override
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message(
{
// ... logging before the call ...
Object result = callback.execute();
// ... logging after the call ...
return result;
}
}
When migrating to webflux and hence to webflux:outbound-gateway, the advice handler is now retrieving a MonoMapFuseable type in the result. Is it possible to read the information from MonoMapFuseable in order to log the return payload without consuming definitively the result? I'm a bit of a loss at how to do this.
Thanks for any insights.
I am not a reactor expert, but you should be able to call
share()on the returned mono; then subscribe to that mono to get a copy of the result.I just tried it with this...