Source:
<code>public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { final BiFunction<Throwable, Object, Throwable> localOperatorErrorHook = getLocalOperatorErrorHook(this, errorTypeLocator, exceptionContextProviders); return subscriberContext() .flatMapMany(ctx -> { final FluxSinkRecorder<Either<Throwable, CoreEvent>> errorSwitchSinkSinkRef = new FluxSinkRecorder<>(); Flux<CoreEvent> transformed = from(propagateCompletion(from(publisher), create(errorSwitchSinkSinkRef) .map(result -> { return result.reduce(me -> { throw propagateWrappingFatal(me); }, response -> response); }), pub -> from(pub) .map(event -> { try { return addContextToEvent(event, ctx); } catch (MuleException t) { throw propagateWrappingFatal(localOperatorErrorHook.apply(t, event)); } }) .doOnNext(event -> { final ExecutorCallback executorCallback = new ExecutorCallback() { @Override public void error(Throwable e) { errorSwitchSinkSinkRef.next(left( localOperatorErrorHook.apply(e, event), CoreEvent.class)); } @Override public void complete(Object value) { errorSwitchSinkSinkRef.next(right(Throwable.class, (CoreEvent) value)); } }; if (!isAsync() && NO_POLICY_OPERATION <START> .equals(((SdkInternalContext) ((InternalEvent) event).<SdkInternalContext>getSdkInternalContext()) <END> .getPolicyToApply())) { onEventSynchronous(event, executorCallback, ctx); } else { onEvent(event, executorCallback); } }), () -> errorSwitchSinkSinkRef.complete(), t -> errorSwitchSinkSinkRef.error(t), muleContext.getConfiguration().getShutdownTimeout(), outerFluxCompletionScheduler)); if (publisher instanceof Flux && !ctx.getOrEmpty(WITHIN_PROCESS_TO_APPLY).isPresent()) { return transformed .doAfterTerminate(this::outerPublisherTerminated) .doOnSubscribe(s -> outerPublisherSubscribedTo()); } else { return transformed; } }); }</code><technical_language>turn this condition a method in SDK internal context</technical_language>

Target:
public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { final BiFunction<Throwable, Object, Throwable> localOperatorErrorHook = getLocalOperatorErrorHook(this, errorTypeLocator, exceptionContextProviders); return subscriberContext() .flatMapMany(ctx -> { final FluxSinkRecorder<Either<Throwable, CoreEvent>> errorSwitchSinkSinkRef = new FluxSinkRecorder<>(); Flux<CoreEvent> transformed = from(propagateCompletion(from(publisher), create(errorSwitchSinkSinkRef) .map(result -> { return result.reduce(me -> { throw propagateWrappingFatal(me); }, response -> response); }), pub -> from(pub) .map(event -> { try { return addContextToEvent(event, ctx); } catch (MuleException t) { throw propagateWrappingFatal(localOperatorErrorHook.apply(t, event)); } }) .doOnNext(event -> { final ExecutorCallback executorCallback = new ExecutorCallback() { @Override public void error(Throwable e) { errorSwitchSinkSinkRef.next(left( localOperatorErrorHook.apply(e, event), CoreEvent.class)); } @Override public void complete(Object value) { errorSwitchSinkSinkRef.next(right(Throwable.class, (CoreEvent) value)); } }; if (!isAsync() && from(event).isNoPolicyOperation()) { onEventSynchronous(event, executorCallback, ctx); } else { onEvent(event, executorCallback); } }), () -> errorSwitchSinkSinkRef.complete(), t -> errorSwitchSinkSinkRef.error(t), muleContext.getConfiguration().getShutdownTimeout(), outerFluxCompletionScheduler)) .doOnNext(event -> ((InternalEvent) event) .setSdkInternalContext(null)); if (publisher instanceof Flux && !ctx.getOrEmpty(WITHIN_PROCESS_TO_APPLY).isPresent()) { return transformed .doAfterTerminate(this::outerPublisherTerminated) .doOnSubscribe(s -> outerPublisherSubscribedTo()); } else { return transformed; } }); }