Reputation: 13
I'm trying to get a value that I have in the context, I canot figure out how can I do that, any idea?, example:
return mono
.doFinally(signalType -> how??? )
.doOnEach(signal -> {
... signal.getContext();
...
}) -> is ok I got the context
.subscriberContext(ctx -> ctx.put("key", "foo"));
Upvotes: 1
Views: 2792
Reputation: 3063
Consider using Mono#deferWithContext
:
return Mono
.deferWithContext(ctx -> {
mono.doFinally(signalType -> handleSignal(ctx, signalType))
.doOnEach(...)
})
// later...
.subscriberContext(ctx -> ctx.put("key", "foo"));
Upvotes: 5