Package org.forgerock.http.protocol
Class MdcAwareSubscriber<T>
- java.lang.Object
-
- org.forgerock.http.protocol.MdcAwareSubscriber<T>
-
- Type Parameters:
T- the type of element signaled.
- All Implemented Interfaces:
org.reactivestreams.Subscriber<T>
public final class MdcAwareSubscriber<T> extends Object implements org.reactivestreams.Subscriber<T>
An implementation ofSubscriberthat will preserve the SLF4JMDC.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> org.reactivestreams.Subscriber<T>mdcAwareSubscriber(Map<String,String> mdc, org.reactivestreams.Subscriber<T> delegate)Wraps the delegateSubscriberwith anotherSubscriberinstance that will use the providedMDCcontext when delegating the calls to the delegatedSubscriber.static <T> org.reactivestreams.Subscriber<T>mdcAwareSubscriber(org.reactivestreams.Subscriber<T> delegate)Wraps the delegateSubscriberwith anotherSubscriberinstance that will capture the currentMDCcontext, and will use it when delegating the calls to the delegatedSubscriber.voidonComplete()voidonError(@NonNull Throwable e)voidonNext(T t)voidonSubscribe(org.reactivestreams.Subscription s)
-
-
-
Method Detail
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription s)
- Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<T>
-
onNext
public void onNext(@NonNull T t)- Specified by:
onNextin interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(@NonNull @NonNull Throwable e)- Specified by:
onErrorin interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfaceorg.reactivestreams.Subscriber<T>
-
mdcAwareSubscriber
public static <T> org.reactivestreams.Subscriber<T> mdcAwareSubscriber(org.reactivestreams.Subscriber<T> delegate)
Wraps the delegateSubscriberwith anotherSubscriberinstance that will capture the currentMDCcontext, and will use it when delegating the calls to the delegatedSubscriber.- Type Parameters:
T- the type of element signaled.- Parameters:
delegate- the Subscriber to delegate the calls to- Returns:
- A
Subscriberthat will position the capturedMDCcontext before each call. - See Also:
mdcAwareSubscriber(Map, Subscriber)
-
mdcAwareSubscriber
public static <T> org.reactivestreams.Subscriber<T> mdcAwareSubscriber(Map<String,String> mdc, org.reactivestreams.Subscriber<T> delegate)
Wraps the delegateSubscriberwith anotherSubscriberinstance that will use the providedMDCcontext when delegating the calls to the delegatedSubscriber.- Type Parameters:
T- the type of element signaled.- Parameters:
mdc- TheMDCto use when delegating the callsdelegate- the Subscriber to delegate the calls to- Returns:
- A
Subscriberthat will position the capturedMDCcontext before each call.
-
-