You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our Quarkus application we use verticles as light-weight actors to keep state of real world devices.
The actor vertical is responsible for persisting it's own state.
When implementing the database persistency we run into several issues. I assume due to that the Verticle run on it's own threadpool on which apparently it's not possible to do database actions.
We're new to Quarkus and have read a lot of it's documentation, but nowhere it is mentioned that the combination of using verticles and IO (like databases) is an issue.
The errors we encounter are either
"Uncaught exception received by Vert.x: io.quarkus.runtime.BlockingOperationNotAllowedException: Cannot start a JTA transaction from the IO thread."
or
"db failed {} : jakarta.enterprise.context.ContextNotActiveException: Cannot use the EntityManager/Session because neither a transaction nor a CDI request context is active. Consider adding @transactional to your method to automatically activate a transaction, or @ActivateRequestContext if you have valid reasons not to use transactions."
We have added the smallrye-context-propagation module. But by itself it does not seem to solve this issue.
We started with Async Postgres with Mutiny and are now trying Hibernate ORM with Panache. All give these same errors.
We're now trying working around it using vertx.executeBlocking(..).
I have worked with Vert.x before long ago and I remember we had a specific database verticle back then, but now I wonder how that could have worked.
What should be to way to perform database, or other IO related, actions from a Verticle?
If find the "Cannot start a JTA transaction from the IO thread" also confusing. I want to do IO, the database action, so why is that not allowed on the IO thread?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In our Quarkus application we use verticles as light-weight actors to keep state of real world devices.
The actor vertical is responsible for persisting it's own state.
When implementing the database persistency we run into several issues. I assume due to that the Verticle run on it's own threadpool on which apparently it's not possible to do database actions.
We're new to Quarkus and have read a lot of it's documentation, but nowhere it is mentioned that the combination of using verticles and IO (like databases) is an issue.
The errors we encounter are either
"Uncaught exception received by Vert.x: io.quarkus.runtime.BlockingOperationNotAllowedException: Cannot start a JTA transaction from the IO thread."
or
"db failed {} : jakarta.enterprise.context.ContextNotActiveException: Cannot use the EntityManager/Session because neither a transaction nor a CDI request context is active. Consider adding @transactional to your method to automatically activate a transaction, or @ActivateRequestContext if you have valid reasons not to use transactions."
We have added the
smallrye-context-propagation
module. But by itself it does not seem to solve this issue.We started with Async Postgres with Mutiny and are now trying Hibernate ORM with Panache. All give these same errors.
We're now trying working around it using
vertx.executeBlocking(..)
.I have worked with Vert.x before long ago and I remember we had a specific database verticle back then, but now I wonder how that could have worked.
What should be to way to perform database, or other IO related, actions from a Verticle?
If find the "Cannot start a JTA transaction from the IO thread" also confusing. I want to do IO, the database action, so why is that not allowed on the IO thread?
Regards.
Beta Was this translation helpful? Give feedback.
All reactions