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 ofSubscriber
that 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 delegateSubscriber
with anotherSubscriber
instance that will use the providedMDC
context when delegating the calls to the delegatedSubscriber
.static <T> org.reactivestreams.Subscriber<T>
mdcAwareSubscriber(org.reactivestreams.Subscriber<T> delegate)
Wraps the delegateSubscriber
with anotherSubscriber
instance that will capture the currentMDC
context, and will use it when delegating the calls to the delegatedSubscriber
.void
onComplete()
void
onError(@NonNull Throwable e)
void
onNext(T t)
void
onSubscribe(org.reactivestreams.Subscription s)
-
-
-
Method Detail
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription s)
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<T>
-
onNext
public void onNext(@NonNull T t)
- Specified by:
onNext
in interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(@NonNull @NonNull Throwable e)
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<T>
-
mdcAwareSubscriber
public static <T> org.reactivestreams.Subscriber<T> mdcAwareSubscriber(org.reactivestreams.Subscriber<T> delegate)
Wraps the delegateSubscriber
with anotherSubscriber
instance that will capture the currentMDC
context, 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
Subscriber
that will position the capturedMDC
context 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 delegateSubscriber
with anotherSubscriber
instance that will use the providedMDC
context when delegating the calls to the delegatedSubscriber
.- Type Parameters:
T
- the type of element signaled.- Parameters:
mdc
- TheMDC
to use when delegating the callsdelegate
- the Subscriber to delegate the calls to- Returns:
- A
Subscriber
that will position the capturedMDC
context before each call.
-
-