When your cloud app declares a migration:managedExports module (see Onboarding to SAM), Atlassian exports that data for you during the migration. As a result, your Data Center (DC) app no longer needs to migrate it.
Your DC app can check at runtime which managed exports are enabled for the current migration. Use this to skip any part of your own migration code that Atlassian now covers, so the same data isn't migrated twice. For example, you can stop sending your own custom field values or attachments when Atlassian exports them.
The configuration comes from the cloud app installed on the destination site for that migration. It reflects the migration:managedExports module of the cloud app version and environment being migrated to as well as what is available within the migrating DC server.
Choose the API for the part of your app making the call:
| Caller | API | Result |
|---|---|---|
| Data Center migration listener (Forge or Connect destination) | gateway.getManagedExports() | Java ManagedExports interfaces with isEnabled() and detail methods. |
| Forge cloud backend | migration.getSamFeatures(transferId) | Exporter configurations with enabled flags and arrays. |
| Connect cloud backend | Not publicly documented. Contact Atlassian for information | Exporter configurations with enabled flags and arrays. |
The APIs report configuration, not processing progress. An enabled exporter does not mean that its files have arrived or been processed. Your cloud app still needs to consume event notifications and file listings, commit processing results and acknowledge files.
atlassian-app-cloud-migration-listener version 1.8.9 or later.isEnabled() == false.1 2 3 4 5 6<dependency> <groupId>com.atlassian</groupId> <artifactId>atlassian-app-cloud-migration-listener</artifactId> <version>1.8.9</version> </dependency>
Call getManagedExports() on the migration gateway that your listener receives. The method is available on both gateway types:
| Listener type | Gateway | Method |
|---|---|---|
DiscoverableForgeListener (Forge) | AppCloudForgeMigrationGateway | ManagedExports getManagedExports() |
DiscoverableListener (Connect) | AppCloudMigrationGateway | ManagedExports getManagedExports() |
The result is scoped to the current migration (transfer). Call it during the migration, for example from onStartAppMigration, rather than caching it across migrations.
Older JCMA and CCMA versions don't implement getManagedExports() and throw an UnsupportedOperationException. Always wrap the call in a try/catch. If it throws, treat every managed export as disabled and fall back to your existing migration code.
ManagedExports interfacecom.atlassian.migration.app.gateway.ManagedExports gives you one exporter per managed export type. Each exporter has an isEnabled() method, plus a method that tells you exactly what Atlassian will export.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28public interface ManagedExports { MappingExporter getMappingExporter(); BinaryExporter getBinaryExporter(); DatabaseExporter getDatabaseExporter(); CustomFieldValuesExporter getCustomFieldValuesExporter(); interface MappingExporter { boolean isEnabled(); List<String> getEntityTypes(); } interface BinaryExporter { boolean isEnabled(); List<String> getDirectories(); } interface DatabaseExporter { boolean isEnabled(); List<String> getTables(); } interface CustomFieldValuesExporter { boolean isEnabled(); List<String> getCustomFieldTypes(); List<String> getCustomFieldNames(); } }
An exporter counts as enabled only when SAM is enabled for the migration and the export type is configured and available for your app. Mapping, binary and custom field values exports use the cloud app's manifest configuration; AO table exports require Early Access onboarding. If an exporter is disabled, its detail methods return an empty list.
| Exporter | Manifest entry | isEnabled() returns true when… | Detail method | Returned value |
|---|---|---|---|---|
MappingExporter | mapping → entityTypes | Atlassian will export at least one entity type. | getEntityTypes() | The entity types whose mappings will be exported, for example jira:issue. Returns ["*"] if all entity types are exported. |
BinaryExporter | binary → directoryPrefix | Atlassian will export at least one directory. | getDirectories() | The directory prefixes, relative to the product home directory, whose files will be exported as binary data. Returns ["/"] if the whole home directory is exported. |
DatabaseExporter | AO tables (Early Access) | Atlassian will export at least one table. | getTables() | The AO tables that will be exported (see the AO File Specification). Returns ["*"] if all your app's tables are exported. |
CustomFieldValuesExporter | customFieldValues → fields | At least one fields entry declares a server.typeKey. | getCustomFieldTypes() | The distinct DC custom field type keys (server.typeKey) whose values JCMA will export. See Custom Field Values. |
The values "*" (mappings and database) and "/" (binary) mean "export everything". Check for them before you compare individual entries.
The following example uses a Forge listener. For a Connect listener, call getManagedExports() on the AppCloudMigrationGateway passed to onStartAppMigration in the same way.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49@Override public void onStartAppMigration(AppCloudForgeMigrationGateway gateway, MigrationDetailsV1 migrationDetails) { ManagedExports managedExports = null; try { managedExports = gateway.getManagedExports(); } catch (UnsupportedOperationException e) { // JCMA/CCMA is too old to support managed exports. Fall back to migrating everything yourself. log.info("Managed exports are not supported by this version of JCMA/CCMA", e); } // Mappings boolean mappingsManaged = managedExports != null && managedExports.getMappingExporter().isEnabled(); List<String> managedEntityTypes = mappingsManaged ? managedExports.getMappingExporter().getEntityTypes() : Collections.emptyList(); // Binary data (attachments and other files) boolean binaryManaged = managedExports != null && managedExports.getBinaryExporter().isEnabled(); List<String> managedDirectories = binaryManaged ? managedExports.getBinaryExporter().getDirectories() : Collections.emptyList(); // AO tables boolean databaseManaged = managedExports != null && managedExports.getDatabaseExporter().isEnabled(); List<String> managedTables = databaseManaged ? managedExports.getDatabaseExporter().getTables() : Collections.emptyList(); // Custom field values boolean customFieldValuesManaged = managedExports != null && managedExports.getCustomFieldValuesExporter().isEnabled(); List<String> managedCustomFieldTypes = customFieldValuesManaged ? managedExports.getCustomFieldValuesExporter().getCustomFieldTypes() : Collections.emptyList(); if (!managedCustomFieldTypes.contains("com.vendor.my-app:my-custom-field-type")) { migrateCustomFieldValues(gateway); } if (!binaryManaged) { uploadAttachments(gateway); } else if (!managedDirectories.contains("/")) { // Upload only the files outside the directories Atlassian exports as defined by your cloud app. uploadAttachmentsExcluding(gateway, managedDirectories); } // ...apply the same approach to mappings and AO tables. }
Use migration.getSamFeatures(transferId) to retrieve the enabled exporters from your Forge backend. Unlike the Data Center Java API, its response uses enabled fields and configuration arrays. It does not enable exporters, download data or complete a migration.
Use @forge/migrations version 3.3.0 or later in your Forge app:
1 2npm install @forge/migrations@^3.3.0
Configure your app for SAM, and deploy and install the intended app version/environment on the destination site.
Call the method from a Forge backend handling the app's migration. Use that migration notification's transferId.
1 2migration.getSamFeatures(transferId: string): Promise<SamFeaturesResponse>
| Parameter | Type | Description |
|---|---|---|
transferId | string | The app migration transfer whose enabled exporters you want to retrieve. |
The SDK makes an authenticated app request to GET /app/migration/forge/v1/sam/{transferId}/features. Use the SDK method in Forge; you do not need to build the request or supply your own authorization token.
The promise resolves to an object with four exporter configurations:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20interface SamFeaturesResponse { mappingExporter: { enabled: boolean; entityTypes: string[]; }; binaryExporter: { enabled: boolean; directories: string[]; }; databaseExporter: { enabled: boolean; tables: string[]; }; customFieldValuesExporter: { enabled: boolean; customFieldTypes: string[]; customFieldNames: string[]; }; }
| Exporter | Configuration | How to use it |
|---|---|---|
mappingExporter | entityTypes | Check enabled before expecting mapping exports; the array identifies their entity types. |
binaryExporter | directories | Identifies the directory prefixes covered by the binary exporter. |
databaseExporter | tables | Identifies the AO tables covered by the database exporter. AO exports require Early Access onboarding. |
customFieldValuesExporter | customFieldTypes, customFieldNames | Identifies the configured custom field values exports. |
Check each exporter's enabled flag before using its configuration. These are configurations for the requested transfer, not a global capability list. Do not reuse one transfer's response to decide how to process another transfer.
An enabled exporter does not mean its files have arrived or been processed. Continue to consume event notifications and file listings, commit processing results, and acknowledge event files. This method does not download data, acknowledge files or complete the migration.
This backend handler logs the enabled exporters. Add your own durable processing logic separately; this example does not process or acknowledge event files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34import { migration, MigrationAPIError } from '@forge/migrations'; export async function onMigrationStarted(event) { if (!event.transferId) { throw new Error('Migration notification is missing transferId'); } try { const features = await migration.getSamFeatures(event.transferId); const exporters = [ ['MAPPINGS', features.mappingExporter.enabled], ['BINARY', features.binaryExporter.enabled], ['DATABASE', features.databaseExporter.enabled], ['CUSTOM_FIELD_VALUES', features.customFieldValuesExporter.enabled], ]; console.log({ transferId: event.transferId, enabledExporters: exporters.filter(([, enabled]) => enabled).map(([label]) => label), }); if (features.mappingExporter.enabled) { console.log({ entityTypes: features.mappingExporter.entityTypes }); } } catch (error) { console.error('Unable to retrieve SAM features', { transferId: event.transferId, status: error instanceof MigrationAPIError ? error.status : undefined, message: error instanceof Error ? error.message : String(error), }); throw error; } }
Wire onMigrationStarted to your existing avi:ecosystem.migration:triggered:listener trigger. This identifier is an event name in modules.trigger.events, not an OAuth scope in permissions.scopes. The SDK uses Forge's authenticated app transport for the request. See the quick start for migration trigger configuration.
The SDK expects HTTP 200 with a JSON response. It rejects the promise for other HTTP statuses or when the response body cannot be parsed as JSON. The SDK publicly exports MigrationAPIError (an alias of its internal APIError class); HTTP failures expose the HTTP status through its status field when available.
getSamFeatures is not a function, check the installed @forge/migrations version, update the dependency and redeploy the app.Every exporter is disabled, but my manifest declares migration:managedExports.
migration:managedExports module is deployed to the Forge environment and installed on the destination site you're migrating to.DiscoverableForgeListener uses its Forge app ID and environment; a DiscoverableListener uses its cloud app key.getManagedExports() throws UnsupportedOperationException.
The JCMA or CCMA version running the migration doesn't support managed exports. Upgrade the migration assistant or handle the exception as shown in the example.
Rate this page: