Class MdcAwareSingleObserver<T>

  • Type Parameters:
    T - the SingleObserver's type.
    All Implemented Interfaces:
    io.reactivex.rxjava3.core.SingleObserver<T>

    public final class MdcAwareSingleObserver<T>
    extends Object
    implements io.reactivex.rxjava3.core.SingleObserver<T>
    A SingleObserver wrapper that manages the MDC.
    • Method Detail

      • onSubscribe

        public void onSubscribe​(@NonNull
                                @NonNull io.reactivex.rxjava3.disposables.Disposable disposable)
        Specified by:
        onSubscribe in interface io.reactivex.rxjava3.core.SingleObserver<T>
      • onError

        public void onError​(@NonNull
                            @NonNull Throwable t)
        Specified by:
        onError in interface io.reactivex.rxjava3.core.SingleObserver<T>
      • onSuccess

        public void onSuccess​(@NonNull
                              T value)
        Specified by:
        onSuccess in interface io.reactivex.rxjava3.core.SingleObserver<T>
      • mdcAwareSingleObserver

        public static <T> io.reactivex.rxjava3.core.SingleObserver<T> mdcAwareSingleObserver​(io.reactivex.rxjava3.core.SingleObserver<T> delegate)
        Wraps the delegate SingleObserver with another SingleObserver instance that will capture the current MDC context, and will use it when delegating the calls to the delegated SingleObserver.
        Type Parameters:
        T - The wrapped SingleObserver's return type.
        Parameters:
        delegate - The wrapped observer
        Returns:
        a wrapped SingleObserver.