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 of 
Subscriber that will preserve the SLF4J MDC.- 
Method Summary
Modifier and TypeMethodDescriptionstatic <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.voidvoidvoidvoidonSubscribe(org.reactivestreams.Subscription s)  
- 
Method Details
- 
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription s) - Specified by:
 onSubscribein interfaceorg.reactivestreams.Subscriber<T>
 - 
onNext
- Specified by:
 onNextin interfaceorg.reactivestreams.Subscriber<T>
 - 
onError
- 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
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. 
 
 -