Class Panache


  • public class Panache
    extends Object
    Utility class for reactive MongoDB with Panache.
    • Constructor Detail

      • Panache

        public Panache()
    • 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 with Panache.withTransaction().
        Returns:
        the current ClientSession or null if none.
        See Also:
        withTransaction(Supplier)