Using MicroProfile Context Propagation to manage context
MicroProfile Context Propagation (https://download.eclipse.org/microprofile/microprofile-context-propagation-1.2/) defines a mechanism for propagating context from the current thread to a new thread. The types of context include the following:
- Application: This normally includes the thread context class loader as well as
java:comp
,java:module
, andjava:app
. - CDI: The scope of the CDI context, such as
SessionScoped
andConversationScoped
, is still active in the new unit of work, such as a newCompeletionStage
. - Security: This includes the credentials that are associated with the current thread.
- Transaction: This is the active transaction scope that is associated with the current thread. This context is not normally expected to be propagated, but cleared instead.
Apart from the aforementioned context, an application can introduce custom context if needed.
To propagate the aforementioned context, this...