Package migratedb.v1.core.api.callback
Interface Callback
-
- All Known Implementing Classes:
BaseCallback,NoopCallback
public interface CallbackThis is the main callback interface that should be implemented to handle MigrateDB lifecycle events.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanHandleInTransaction(Event event, Context context)Whether this event can be handled in a transaction or whether it must be handled outside a transaction instead.StringgetCallbackName()The callback name, MigrateDB will use this to sort the callbacks alphabetically before executing themvoidhandle(Event event, Context context)Handles this MigrateDB lifecycle event.booleansupports(Event event, Context context)Whether this callback supports this event or not.
-
-
-
Method Detail
-
supports
boolean supports(Event 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:
trueif it can be handled,falseif not.
-
canHandleInTransaction
boolean canHandleInTransaction(Event 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 betrue. Only in the rare cases where non-transactional statements are executed should this returnfalse. This method is called beforehandle(Event, 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:
trueif it can be handled within a transaction (almost all cases).falseif it must be handled outside a transaction instead (very rare).
-
handle
void handle(Event event, Context context)
Handles this MigrateDB lifecycle event.- Parameters:
event- The event to handle.context- The context for this event.
-
getCallbackName
String getCallbackName()
The callback name, MigrateDB will use this to sort the callbacks alphabetically before executing them- Returns:
- The callback name
-
-