Class Panache
- java.lang.Object
-
- io.quarkus.mongodb.panache.common.reactive.Panache
-
public class Panache extends Object
Utility class for reactive MongoDB with Panache.
-
-
Constructor Summary
Constructors Constructor Description Panache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.mongodb.reactivestreams.client.ClientSession
getCurrentSession()
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.
-
-
-
Method Detail
-
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:
withTransaction(Supplier)
-
-