Class Panache
java.lang.Object
io.quarkus.mongodb.panache.common.reactive.Panache
Utility class for reactive MongoDB with Panache.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.mongodb.reactivestreams.client.ClientSession
Allow to access the current MongoDB session.static <T> io.smallrye.mutiny.Uni<T>
withTransaction
(Supplier<io.smallrye.mutiny.Uni<T>> work) Performs the given work within the scope of a MongoDB transaction.
-
Constructor Details
-
Panache
public Panache()
-
-
Method Details
-
withTransaction
public static <T> io.smallrye.mutiny.Uni<T> withTransaction(Supplier<io.smallrye.mutiny.Uni<T>> work) Performs the given work within the scope of a MongoDB transaction. The transaction will be rolled back if the work completes with an uncaught exception.- Type Parameters:
T
- The function's return type- Parameters:
work
- The function to execute in the new transaction- Returns:
- the result of executing the function
-
getCurrentSession
public static com.mongodb.reactivestreams.client.ClientSession getCurrentSession()Allow to access the current MongoDB session. The session will only exist in the context of a reactive MongoDB with Panache transaction started withPanache.withTransaction()
.- Returns:
- the current ClientSession or null if none.
- See Also:
-