Tests waiting mechanisms in reactive event-loop context #33553
Unanswered
silviu-negoita
asked this question in
Q&A
Replies: 1 comment
-
Update: I think I came with a solution: The initial thread is event-loop because I used
I am open to new ideas, because I find this approach closer to a workaround rather to an official solution. Later update: More on that, I created this to wrap blocking operations:
Now it can be used like this:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a test in quarkus 3.0, where I need to interact with the DB and websockets.
I am using
@TestReactiveTransaction
andUniAsserter asserter
which are needed for hibernate reactive.Here are a list of operations I have for a test:
asserter.execute()
@OnOpen
method.Between 3 and 4 I am losing the reactivity chain (I cannot write my code in reactive manner, chaining the operations). I have to manually wait for some time for the data to get processed.
Before quarkus 3, I had two mechanisms to wait:
awaitility:org.awaitility
to wait my data to be processed after websocket connects. e.g.await().atMost(1, SECONDS).until(() -> securedSessions.size() == 1)
LinkedBlockingDeque<String>
and it's poll method:serverMessages.poll(4000, MILLISECONDS)
But starting with quarkus 3, I cannot do this anymore because it blocks event-loops threads.
Are there any suggestions how I can go further with this? Maybe if I can switch back and forth from a event-loop thread to a regular thread where I can block?
What I tried:
@TestReactiveTransaction
andUniAsserter asserter
and try to manually activate vertx context (on event-loop thread) when db interactions are needed. But again, I cannot chain the operations.Ref I used:
https://quarkus.io/guides/hibernate-reactive-panache#testing
https://quarkus.io/guides/websockets#websocket-clients
Beta Was this translation helpful? Give feedback.
All reactions