spring-framework/framework-docs
Brian Clozel ef2a403df6 Add PropagationContextElement Kotlin operator
Prior to this commit, the Micrometer context-propagation project would
help propagating information from `ThreadLocal`, Reactor `Context` and
other context objects. This is already well supported for Micrometer
Observations.

In the case of Kotlin suspending functions, the processing of tasks
would not necessarily update the `ThreadLocal` when the function is
scheduled on a different thread.

This commit introduces the `PropagationContextElement` operator that
connects the `ThreadLocal`, Reactor `Context` and Coroutine `Context`
for all libraries using the "context-propagation" project.

Applications must manually use this operator in suspending functions
like so:

```
suspend fun suspendingFunction() {
  return withContext(PropagationContextElement(currentCoroutineContext())) {
    logger.info("Suspending function with traceId")
  }
}
```

Closes gh-35185
2025-09-09 21:42:08 +02:00
..
modules/ROOT Add PropagationContextElement Kotlin operator 2025-09-09 21:42:08 +02:00
src Add PropagationContextElement Kotlin operator 2025-09-09 21:42:08 +02:00
antora-playbook.yml Upgrade to antora-ui-spring version 0.4.18 2024-11-15 14:32:01 +01:00
antora.yml Consistent line breaks in reference documentation 2025-07-10 19:33:34 +02:00
framework-docs.gradle Add PropagationContextElement Kotlin operator 2025-09-09 21:42:08 +02:00
package.json Fix broken antora task 2025-02-19 16:40:50 +01:00