Class MdcAwareAction

  • All Implemented Interfaces:
    io.reactivex.rxjava3.functions.Action

    public final class MdcAwareAction
    extends Object
    implements io.reactivex.rxjava3.functions.Action
    An implementation of Action that will preserve the SLF4J MDC.
    • Method Detail

      • run

        public void run()
                 throws Throwable
        Specified by:
        run in interface io.reactivex.rxjava3.functions.Action
        Throws:
        Throwable
      • mdcAwareAction

        public static io.reactivex.rxjava3.functions.Action mdcAwareAction​(io.reactivex.rxjava3.functions.Action delegate)
        Wraps the delegate Action with another Action instance that will capture the current MDC context, and will use it when delegating the calls to the delegated Action.
        Parameters:
        delegate - the Subscriber to delegate the calls to
        Returns:
        A Action that will position the captured MDC context before each call.
        See Also:
        mdcAwareAction(Action)
      • mdcAwareAction

        public static io.reactivex.rxjava3.functions.Action mdcAwareAction​(Map<String,​String> mdc,
                                                                           io.reactivex.rxjava3.functions.Action delegate)
        Wraps the delegate Action with another Action instance that will use the provided MDC context when delegating the calls to the delegated Action.
        Parameters:
        mdc - The MDC to use when delegating the calls
        delegate - the Action to delegate the calls to
        Returns:
        A Action that will position the captured MDC context before each call.