Skip to content

Blocking transaction inside websocket #44463

Answered by mkouba
salemsd asked this question in Q&A
Discussion options

You must be logged in to vote

Well, I don't think it's a good idea to mix the reactive pipelines (Mutiny) together with JTA (@Transactional), which is inherently a blocking technology. It will be inefficient at the very least.

You can annotate the WS endpoint callback method with @io.smallrye.common.annotation.Blocking in order to instruct Quarkus to execute the method on a worker thread. Alternatively, just copy the logic from VertxContextSupport#executeBlocking(Callable<T>) and wrap the invocation of saveMessage(). Finally, you can also consider using Hibernate Reactive API .

It seems that Quarkus REST has a specific rule for @Transactional: "If a method or class is annotated with jakarta.transaction.Transactional t…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@salemsd
Comment options

@mkouba
Comment options

mkouba Nov 14, 2024
Collaborator

Answer selected by salemsd
@cescoffier
Comment options

@mkouba
Comment options

mkouba Nov 14, 2024
Collaborator

@salemsd
Comment options

@mkouba
Comment options

mkouba Dec 3, 2024
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants