extensions/smallrye-context-propagation/deployment/src/main/resources/META-INF/quarkus-skill.md
The extension is included transitively by most reactive extensions. It ensures CDI request context, transaction context, and other thread-local state propagates correctly across async boundaries (reactive pipelines, Uni/Multi).
In most cases, no code changes are needed — context propagation works automatically.
Add this extension when:
CompletionStage, CompletableFuture or ExecutorService manually and CDI context is lost@RequestScoped beans or @Transaction contextInject a context-aware executor instead of creating raw thread pools:
@ApplicationScoped
public class MyService {
@Inject
ManagedExecutor executor;
public CompletionStage<String> asyncWork() {
return executor.supplyAsync(() -> {
// CDI request context is available here
return myRequestScopedBean.getValue();
});
}
}
Wrap tasks to propagate context when using executors not managed by Quarkus:
@ApplicationScoped
public class MyService {
@Inject
ThreadContext threadContext;
public void submitWork(ExecutorService someExternalExecutor) {
Runnable wrapped = threadContext.contextualRunnable(() -> {
// CDI context propagated from the calling thread
});
someExternalExecutor.execute(wrapped);
}
}
Also available: contextualCallable(), contextualConsumer(), contextualFunction(), contextualSupplier().
# Control which contexts propagate (rarely needed)
mp.context.ManagedExecutor.propagated=CDI,Transaction
mp.context.ManagedExecutor.cleared=Remaining
mp.context.ManagedExecutor.maxAsync=5
mp.context.ManagedExecutor.maxQueued=20
ExecutorService: Use @Inject ManagedExecutor instead — it propagates CDI context. Raw Executors.newFixedThreadPool() loses all context.@RequestScoped in async code: Without context propagation, @RequestScoped beans throw ContextNotActiveException on other threads. This extension fixes that.@Transactional method's transaction extends to ManagedExecutor tasks.