CorrelationContextElement

class CorrelationContextElement(snapshot: Map<String, String> = CorrelationContext.snapshot()) : CoroutineContext.Element

Coroutine context element for propagating correlation context across dispatchers.

Usage:

withContext(Dispatchers.IO + CorrelationContextElement()) {
// CorrelationContext is available here
}

Since

0.4.0

Constructors

Link copied to clipboard
constructor(snapshot: Map<String, String> = CorrelationContext.snapshot())

Types

Link copied to clipboard

Properties

Link copied to clipboard
open override val key: CoroutineContext.Key<*>

Functions

Link copied to clipboard
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
Link copied to clipboard
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
Link copied to clipboard
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext
Link copied to clipboard
fun restore()

Restore the captured context to the current thread.