Skip to content

v0.2.0 — Transactional Outbox

Choose a tag to compare

@woduda woduda released this 08 Jun 19:55
· 11 commits to main since this release

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 migrate

Enable in config/civicrm.php or .env:

CIVICRM_OUTBOX=true

Added

  • OutboxEntry Eloquent model (status, attempts, dedupe_key, available_at, last_error columns)
  • OutboxRepositorypush() / pushSyncContact() / pushCreateActivity() / reserveBatch() / markDone() / markFailed()
  • civicrm:outbox:work artisan command — synchronous drain with --limit and --max-attempts; exponential backoff capped at 3600 s; ValidationException causes immediate permanent failure
  • create_civicrm_outbox_table migration stub (publishable)
  • ContactInput::toArray() for lossless round-trip serialisation

See CHANGELOG.md for details.