Seeking advice on running blocking code and context/thread management? #45882
gunjanthesystem
started this conversation in
Community
Replies: 1 comment 1 reply
-
\CC @jponge |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Aim: to execute 3 tasks in sequence: consider them like one time thing to do when the application starts - like data cleaning, transformation and load. Below is a toy example to demonstrate:
Task 1: has calls to blocking methods like loading data from GCP buckets.
Task 2: is non blocking data transformation
Task 3: is loading data into postgres db using Hibernate Reactive Panache.
Question 1: What is the recommended way to execute task1WithBlocking on worker thread. using runSubscriptionOn or there is better approach including design change.
Question 2: When task1WithBlocking is put on executor thread, how to keep Task 2 and Task 3 on the original thread?
Question 3: OnStart starts on Quarkus Main Thread, this will cause issues for Hibernate Reactive Panache as it need vertx event loop. Is there a better way?
Please advise if there is a better way to do this given the contraints. (Trying to shift to a reactive approach but stuck on this issue for a while. Open to all suggestions.)
Beta Was this translation helpful? Give feedback.
All reactions