Class MdcAwareSingleObserver<T>

java.lang.Object
org.forgerock.openig.reactive.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 Summary

    Modifier and Type
    Method
    Description
    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.
    void
    onError(@NonNull Throwable t)
     
    void
    onSubscribe(@NonNull io.reactivex.rxjava3.disposables.Disposable disposable)
     
    void
    onSuccess(T value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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.