Interface GenericCallback<E extends CallbackEvent<E>>

Type Parameters:
E - The callback event type
All Known Subinterfaces:
Callback
All Known Implementing Classes:
BaseCallback

public interface GenericCallback<E extends CallbackEvent<E>>
Generic version of the CallbackEvent interface, allowing for additional events defined outside core
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canHandleInTransaction(E event, Context context)
    Whether this event can be handled in a transaction or whether it must be handled outside a transaction instead.
    The callback name, Flyway will use this to sort the callbacks alphabetically before executing them
    void
    handle(E event, Context context)
    Handles this Flyway lifecycle event.
    boolean
    supports(E event, Context context)
    Whether this callback supports this event or not.
  • Method Details

    • supports

      boolean supports(E event, Context context)
      Whether this callback supports this event or not. This is primarily meant as a way to optimize event handling by avoiding unnecessary connection state setups for events that will not be handled anyway.
      Parameters:
      event - The event to check.
      context - The context for this event.
      Returns:
      true if it can be handled, false if not.
    • canHandleInTransaction

      boolean canHandleInTransaction(E event, Context context)
      Whether this event can be handled in a transaction or whether it must be handled outside a transaction instead. In the vast majority of the cases the answer will be true. Only in the rare cases where non-transactional statements are executed should this return false. This method is called before handle(E, Context) in order to determine in advance whether a transaction can be used or not.
      Parameters:
      event - The event to check.
      context - The context for this event.
      Returns:
      true if it can be handled within a transaction (almost all cases). false if it must be handled outside a transaction instead (very rare).
    • handle

      void handle(E event, Context context)
      Handles this Flyway lifecycle event.
      Parameters:
      event - The event to handle.
      context - The context for this event.
    • getCallbackName

      String getCallbackName()
      The callback name, Flyway will use this to sort the callbacks alphabetically before executing them
      Returns:
      The callback name