I have a Quarkus app with REST API and multiple services that are @ApplicationScoped
, and one bean that is @RequestScoped
(it has data related to JWT, cookies etc).
When the REST API is invoked, I want to do some work synchronously and then return an answer to the client but to keep doing async work with the same RequestScoped bean (context data).
I tried to propagate the RequestScoped bean to the thread that will handle the async task, but once the HTTP request is finished, the RequestScoped bean is getting deleted.
What is the correct way of doing this?
Basically I want to share some context across a flow that involves sync and async tasks