Package org.forgerock.http.protocol
Class MdcAwareConsumer<T>
java.lang.Object
org.forgerock.http.protocol.MdcAwareConsumer<T>
- Type Parameters:
 T- the value type
- All Implemented Interfaces:
 io.reactivex.rxjava3.functions.Consumer<T>
public final class MdcAwareConsumer<T>
extends Object
implements io.reactivex.rxjava3.functions.Consumer<T>
An implementation of 
Consumer that will preserve the SLF4J MDC.- 
Method Summary
Modifier and TypeMethodDescriptionvoidstatic <T> io.reactivex.rxjava3.functions.Consumer<T>mdcAwareConsumer(io.reactivex.rxjava3.functions.Consumer<T> delegate) Wraps the delegateConsumerwith anotherConsumerinstance that will capture the currentMDCcontext, and will use it when delegating the calls to the delegatedConsumer.static <T> io.reactivex.rxjava3.functions.Consumer<T>mdcAwareConsumer(Map<String, String> mdc, io.reactivex.rxjava3.functions.Consumer<T> delegate) Wraps the delegateConsumerwith anotherConsumerinstance that will use the providedMDCcontext when delegating the calls to the delegatedConsumer. 
- 
Method Details
- 
accept
 - 
mdcAwareConsumer
public static <T> io.reactivex.rxjava3.functions.Consumer<T> mdcAwareConsumer(io.reactivex.rxjava3.functions.Consumer<T> delegate) Wraps the delegateConsumerwith anotherConsumerinstance that will capture the currentMDCcontext, and will use it when delegating the calls to the delegatedConsumer.- Type Parameters:
 T- the value type.- Parameters:
 delegate- the Subscriber to delegate the calls to- Returns:
 - A 
Consumerthat will position the capturedMDCcontext before each call. - See Also:
 
 - 
mdcAwareConsumer
public static <T> io.reactivex.rxjava3.functions.Consumer<T> mdcAwareConsumer(Map<String, String> mdc, io.reactivex.rxjava3.functions.Consumer<T> delegate) Wraps the delegateConsumerwith anotherConsumerinstance that will use the providedMDCcontext when delegating the calls to the delegatedConsumer.- Type Parameters:
 T- the value type.- Parameters:
 mdc- TheMDCto use when delegating the callsdelegate- the Consumer to delegate the calls to- Returns:
 - A 
Consumerthat will position the capturedMDCcontext before each call. 
 
 -