This module automatically re-queues the migrate failed rows so that they can be re-migrated. It is useful in case a row can not be migrated due to errors that can not be migrated from the migration side. For example: when the destination is a third party, and it has a temporary problem that won't be solved until some specific time, in that case, it is needed to re-migrate that item later.

The number of a row that is retried to migrate is limited to prevent bottlenecks. Currently, the maximum number of retries is 5.

Installation

After installing the module in an usual way, it is needed to add this line to the settings.php:

$settings['queue_service_migrate_retry'] = 'queue.migrate_retry';

Configuration

On the configuration page, check which migrations do you want to use the migrate_retry system.

How it works

To make the migrate items to be retried, it is needed to throw a MigrateException with the needs retry status (\Drupal\migrate_retry\MigrateIdMapInterface::STATUS_NEEDS_RETRY), when the items are failing. Only those rows having the source_row_status value as needs retry will be retried.

There is an example about how to throw the exception at the migrate destination used for tests.

After marking the row with that status, that row will be enqueued by the cron, and a queue worker will re-migrate the item.

It is also possible to enqueue items to retry using the queue manager service:

// Ids of a migrate row in which sourceid1 is 1 and sourceid2 is 34.
$source_ids = [1, 34]
$migration_id = 'my_custom_migration';
\Drupal::service('migrate_retry.queue_manager')->enqueueMigrateRow($migration_id, $source_ids);
Supporting organizations: 
Module development.

Project information

Releases