Interface MigrationTask
-
- All Known Implementing Classes:
MessageSubscriptionSentTimeMigration
,ProcessMessageSubscriptionSentTimeMigration
public interface MigrationTask
Interface for migration tasks.Implementations of this class can/must assume the following contract:
- Implementation will be called before any processing is performed
- Implementation will be called with an open database and open transaction
- Implementation may be called more than once throughout the lifetime of the deployment of a given version of software in production
- The method
runMigration(...)
will only be called afterneedsToRun(...)
was called and did returntrue
- All methods should be implemented with the context in mind, that they will be called synchronously during recovery.
- Migrations that are expected to potentially take a long time, should only be implemented after https://github.com/camunda-cloud/zeebe/issues/7248 has been solved
- None of the methods must commit or roll back the transaction. The transaction is handled outside
- Methods may throw exceptions to indicate a critical error during migration
- Any exception thrown will cancel all subsequent migrations and will prevent the stream processor from starting
- Therefore, great care shall be taken to handle exceptions and recoverable situations internally
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getIdentifier()
Returns identifier for the migration task.boolean
needsToRun(ZeebeState zeebeState)
Returns whether the migration needs to runvoid
runMigration(MutableZeebeState zeebeState)
Implementations of this method perform the actual migration
-
-
-
Method Detail
-
getIdentifier
String getIdentifier()
Returns identifier for the migration task.The identifier is used for logging.
In the future, it might also be used to store the migrations that were run in persistent state
- Returns:
- identifier for the migration task
-
needsToRun
boolean needsToRun(ZeebeState zeebeState)
Returns whether the migration needs to run- Parameters:
zeebeState
- the immutable Zeebe state- Returns:
- whether the migration needs to run
-
runMigration
void runMigration(MutableZeebeState zeebeState)
Implementations of this method perform the actual migration- Parameters:
zeebeState
- the mutable Zeebe state
-
-