v0.2.0 — Transactional Outbox
What's new
Transactional Outbox
Write CiviCRM side-effects into the same DB transaction as your domain model — no distributed transaction required.
Usage:
use CiviCrm\Laravel\Outbox\OutboxRepository;
use Illuminate\Support\Facades\DB;
DB::transaction(function () use ($outbox, $contactInput): void {
$domain->save();
$outbox->pushSyncContact($contactInput);
});Add to your scheduler:
$schedule->command('civicrm:outbox:work')->everyMinute();Publish the migration:
php artisan vendor:publish --tag=civicrm-laravel-migrations
php artisan migrateEnable in config/civicrm.php or .env:
CIVICRM_OUTBOX=trueAdded
OutboxEntryEloquent model (status,attempts,dedupe_key,available_at,last_errorcolumns)OutboxRepository—push()/pushSyncContact()/pushCreateActivity()/reserveBatch()/markDone()/markFailed()civicrm:outbox:workartisan command — synchronous drain with--limitand--max-attempts; exponential backoff capped at 3600 s;ValidationExceptioncauses immediate permanent failurecreate_civicrm_outbox_tablemigration stub (publishable)ContactInput::toArray()for lossless round-trip serialisation
See CHANGELOG.md for details.