Replies: 4 comments 13 replies
-
/cc @DavideD (hibernate-reactive), @Sanne (hibernate-reactive), @evanchooly (kotlin), @gavinking (hibernate-reactive), @geoand (kotlin) |
Beta Was this translation helpful? Give feedback.
-
I am pretty sure that Quartz allows you to specify the executor to be used. @machi1990 @mkouba do you guys have any examples where we use the EventLoop as the Quartz executor? |
Beta Was this translation helpful? Give feedback.
-
Currently investigating whether it's smarter (or even possible) to combine hibernate reactive and "hibernate blocking" in one and the same app. Would mean that we have to double a lot of code to have a sync, blocking and an async, non blocking implementation (basically the coloring problem) but if it works... Right now because of the background jobs the pods die like flies. The API endpoints that can be totally reactive and non-blocking work like a charm and we are happy with them (unless the background job blocks the eventloop again and all goes down) |
Beta Was this translation helpful? Give feedback.
-
Using blocking Hibernate for the background job would certainly make more sense. However at the time being I don't think we allow mixing Hibernate ORM and Hibernate Reactive in the same application (this restriction will likely be lifted in the future). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Similar to #32665 I have a question
We are facing a similar problem.
We have a background job running in a k8s cluster and need to ensure it's only executed once at the same time.
Team decided to go with the proven DB approach instead of redis and use a shedlock in a db.
So whenever the job runs we need to get a lock-entry in the DB.
If there exists a lock that has not yet exceeded the maximum length a lock might live, we return.
If there is a lock that has exceeded it's maximum lifetime we delete it and attempt to create a new one. (race condition, others might try as well)
If there is no lock, we attempt to create a new one (again, race condition, others might try as well)
Once we have a lock, we execute our blocking logic - going to the filesystem, reading in some files and again (!) doing some db inserts via hibernate-reactive.
The processing of the files is what is blocking and depending on the file may take quite a few seconds. During that timeframe, when we block the eventloop, the pod gets killed because it's unresponsive.
To make matters worse we rely on quartz and schedule by some config item - so we can't hardcode something like:
We need it to be something like:
The problem is that we always faced the
HR000069: Detected use of the reactive Session from a different Thread than the one which was used to open the reactive Session - this suggests an invalid integration
et al exceptions... if we block the event loop or pods die like flies.
We haven't found a solution yet. I am currently migrating to quarkus 3 to see if we can make this work somehow.
It's interesting how alien reactive programming feels in Java. Never had any problems in any other language (including Scala and Kotlin) but with vert.x, mutiny and quarkus we keep on struggling.
I am open to switch to something else but hibernate-reactive, for the background-job stuff. Actually I am open for any hints how to resolve this.
Thanks in advance for any ideas!
Beta Was this translation helpful? Give feedback.
All reactions