-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Transaction support for MongoDB with Panache #14002
Transaction support for MongoDB with Panache #14002
Conversation
@FroMage I made this new prototype for Transaction support for MongoDB with Panache with some adjustements based on your feedbacks on #10097 (comment)
So now, I don't use a CDI interceptor and I create the session when needed. I need to re-implement everything as due to the changes for Kotlin support, my old branch cannot be rebased, as it'll take some time I want to be sure that this is the good direction before going on so I just implement one method to show you how it will be used. If you validate the design, I'll report all the changes from my old branch. With this design, I'll still need to find a way to pass the transaction options from the calling method (to be discussed later). |
Sorry it took such a long time. This looks just fine to me :) |
OK great ! |
b92b37a
to
a46b900
Compare
a46b900
to
b8c30e2
Compare
87a72f9
to
37e131b
Compare
@gytis I implemented transaction support for MongoDB with Panache and it crashed the integration test of rest data support for MongoDB with Panache. Apparently, you add the I think the best would be to disabled transaction for MongoDB via Rest Data Panache, I'm not sure how to do this. |
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.
Just had the one question about that exception but otherwise looks nice.
.../runtime/src/main/java/io/quarkus/mongodb/panache/transaction/MongoTransactionException.java
Show resolved
Hide resolved
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.
LGTM, but you may want to add the following methods?
public class Panache {
/**
* Returns the current {@link TransactionManager}
*
* @return the current {@link TransactionManager}
*/
public static TransactionManager getTransactionManager() {
return AbstractJpaOperations.getTransactionManager();
}
/**
* Marks the current transaction as "rollback-only", which means that it will not be
* committed: it will be rolled back at the end of this transaction lifecycle.
*/
public static void setRollbackOnly() {
AbstractJpaOperations.setRollbackOnly();
}
}
I'm not sure if TransactionManager
is visible in Mongo, now that you depend on narayana.
...mongodb-panache/src/test/java/io/quarkus/it/mongodb/panache/MongoReplicaSetTestResource.java
Show resolved
Hide resolved
@FroMage there is no global |
Oh, I didn't know. |
3fe2a97
to
3b1122a
Compare
3b1122a
to
20edd61
Compare
@loicmathieu sorry for a delay. I was on PTO since the middle of the last week. |
@gytis thanks for looking at it
No problem for the delay, it gives me the opportunity to have a look at the impl of rest data and it's an interesting piece of code ;) |
Fixes #11294