smallrye-fault-tolerance icon indicating copy to clipboard operation
smallrye-fault-tolerance copied to clipboard

should request context be force-activated for @Asynchronous methods if context propagation is used?

Open Ladicek opened this issue 4 years ago • 1 comments

When MicroProfile Context Propagation integration is not enabled, SmallRye Fault Tolerance obeys the MicroProfile Fault Tolerance specification and always activates the CDI request context for @Asynchronous method invocations.

However, when MicroProfile Context Propagation integration is enabled, we leave everything to Context Propagation. This means that if the request context is not active on the original thread, it isn't active during the @Asynchronous method invocation either. This is contrary to the spec, but makes more sense from the Context Propagation perspective.

I have implemented a fix that enforces request context activation even in presence of Context Propagation integration, but I'm not sure if that's correct. I tend to think that the current behavior is more appropriate, but we can debate it here.

(Note that in Quarkus, SmallRye Fault Tolerance always has the Context Propagation integration enabled.)

Ladicek avatar Jan 12 '21 13:01 Ladicek

Note to self: comes from this discussion: https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Microprofile.20.40Asynchronous.20when.20RequestScoped.20is.20not.20active

Ladicek avatar Jan 12 '21 16:01 Ladicek