Skip to content

Pass the source definition to migration callbacks#4219

Open
roumn wants to merge 1 commit into
flowable:mainfrom
roumn:migration-callback-source-definition
Open

Pass the source definition to migration callbacks#4219
roumn wants to merge 1 commit into
flowable:mainfrom
roumn:migration-callback-source-definition

Conversation

@roumn

@roumn roumn commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What

CaseInstanceMigrationCallback and ProcessInstanceMigrationCallback previously only received the definition an instance was migrated to. They now also receive the definition it was migrated from, so listeners can compare source and target (e.g. version-aware auditing or reacting to specific upgrade paths).

How

Backwards compatible via a new default overload on each callback method that takes the source definition as an extra parameter and delegates to the existing method. Existing implementations keep working unchanged; the engines now invoke the new overloads.

  • CaseInstanceMigrationCallback#caseInstanceMigrated and #historicCaseInstanceMigrated gain a sourceCaseDefinition parameter.
  • ProcessInstanceMigrationCallback#processInstanceMigrated gains a sourceProcessDefinition parameter.

The source definition is resolved from the instance's pre-migration definition id, captured before the reference is overwritten, and only resolved when at least one callback is registered (no overhead otherwise).

Tests

Adds CaseInstanceMigrationCallbackTest and ProcessInstanceMigrationCallbackTest covering the source definition on runtime and historic migrations, plus that callbacks implementing only the original methods are still invoked. Existing migration test suites (CaseInstanceMigrationTest, HistoricCaseInstanceMigrationTest, ProcessInstanceMigrationTest) remain green.

CaseInstanceMigrationCallback and ProcessInstanceMigrationCallback previously
only received the definition an instance was migrated *to*. They now also
receive the definition it was migrated *from*, so listeners can compare source
and target (e.g. version-aware auditing or reacting to specific upgrade paths).

This is done backwards compatibly via a new default overload on each callback
method that takes the source definition as an extra parameter and delegates to
the existing method. Existing implementations keep working unchanged; the
engines now invoke the new overloads:

- CaseInstanceMigrationCallback#caseInstanceMigrated and
  #historicCaseInstanceMigrated gain a sourceCaseDefinition parameter.
- ProcessInstanceMigrationCallback#processInstanceMigrated gains a
  sourceProcessDefinition parameter.

The source definition is resolved from the instance's pre-migration definition
id, captured before the reference is overwritten, and only resolved when at
least one callback is registered (no overhead otherwise).

Adds CaseInstanceMigrationCallbackTest and ProcessInstanceMigrationCallbackTest
covering the source definition on runtime and historic migrations, plus that
callbacks implementing only the original methods are still invoked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant