-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce QuarkusTransaction#runner #28903
Introduce QuarkusTransaction#runner #28903
Conversation
91a5406
to
0eda943
Compare
This comment has been minimized.
This comment has been minimized.
I personally like it a lot, but @FroMage is the API expect as far as I am concerned, so I'll defer to him on whether this is the best approach or not. |
@Sgitario could you have a look at the failures above ^. From what I can see, this is failing since the merge of the Kubernetes dev services? |
Yep, these failures should be related to the changes in #28305. |
0eda943
to
604d20d
Compare
Hi. So, first we perhaps need to clear up the word Second, in terms of UX, if I go to my IDE and start typing Otherwise, I prefer the last proposed option where I can do WDYT? |
This comment has been minimized.
This comment has been minimized.
My "nativeness" is totally based on speaking the language growing up, I don't have any formal training it - that means that I only know what sounds "right" to me and occassionaly this does not correspond to proper use of the language. With that caveat, I can't think of a situation where I would |
604d20d
to
249181f
Compare
Thanks for the feedback!
Done: converted everything I could find to "semantics"
IDEA seems to, but that seems a bit random. Regardless, that's a valid argument.
Done. Though I went with Does this look better? |
This comment has been minimized.
This comment has been minimized.
249181f
to
38df3fa
Compare
This comment has been minimized.
This comment has been minimized.
…") in non-deprecated APIs
… entrypoint to create runners
38df3fa
to
00c4167
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome back
From what I can see, the Mac OS failure is unrelated to this PR. Merging, thanks! |
I added a section to the migration guide: https://github.com/quarkusio/quarkus/wiki/Migration-Guide-2.16#quarkus-transaction |
Addresses the problem discussed on the mailing list, namely the fact that
QuarkusTransaction#run()
/QuarkusTransaction#call
have a default semantic that is not necessarily obvious.Note this does not implement the solution requested in #28579, so merging this PR should not close that issue as "fixed". Maybe we should close it as "not planned", though, since it probably won't be relevant anymore.
The solution we discussed is simple: we expect the semantic to be specified explicitly.
To specify the semantic explicitly, we originally decided to create "one method per semantic". But... it's not that simple. There are actually 4 methods, all slight variations of the same concept:
Runnable
vs.Callable
RunOptions
parameter vs. without.If we duplicated that for every semantic, we would end up with a lot of variations:
Runnable
vs.Callable
RunOptions
parameter vs. without.We're already at
4*2*2 = 16
methods. I'm concerned that could be even more confusing that non-obvious defaults.So... I took a slightly different approach. We still have an explicit semantic, but it's a parameter of the method. And, for reasons I'll detail below, I also replaced
RunOptions
with a new concept ofTransactionRunner
(quite similar to Spring'sTransactionTemplate
, as it turns out).There is now a single entrypoint:
And instead of this:
Users will now have to do this:
The syntax is slightly more verbose, but then that's to be expected if we want to be more explicit.
Alternatively, we could have gone with
QuarkusTransaction.run(Semantic, RunOptions, Runnable)
and deprecated/removed the.semantic(...)
setter fromRunOptions
. However:With the solution in this PR, there's a single entry point and users can discover their options step by step (first the semantics, then the options, then the various types of callbacks).
semantic(...)
setter fromRunOptions
we would end up allowing weird code such as:We could theoretically go one step further and actually introduce one method per semantic (since the other variations are now hidden in the
TransactionRunner
DSL). I'm not sure how useful that would be, but let me know if you think that's necessary:cc @FroMage @geoand