Queue Workers
The Middleware Platform relies on Laravel queues for all asynchronous pricing-sync work. This page describes the queues, jobs, and operational considerations.
Queue Names
| Queue | Purpose |
|---|---|
nfusion | NFusion pricing sync jobs |
default | Standard Laravel jobs (if any) |
Always start a worker that listens to the nfusion queue when running locally or in staging:
php artisan queue:work --queue=nfusion
NFusionSyncTenantPricesJob
File: app/Jobs/NFusionSyncTenantPricesJob.php
This job is the entry point for a single tenant's price sync. When dispatched:
- Instantiates
PriceSyncService - Calls
syncPricesForTenant($tenant)which:- Fetches all active sync targets for the tenant
- Calls
NFusionService::getPrices()once (shared across all targets) - Iterates targets and calls the relevant provider's
sync()method - Updates
last_synced_aton the tenant record - Pings the healthcheck URL if configured
Scheduling
The sync job is scheduled in app/Console/Kernel.php (Laravel 10 style) or routes/console.php (Laravel 11 style). By default it runs every 5 minutes for all active tenants.
Schedule::call(function () {
app(PriceSyncService::class)->syncAllTenants();
})->everyFiveMinutes()->onQueue('nfusion');
On Laravel Vapor, the scheduler is triggered by an AWS EventBridge rule every minute, and the schedule itself filters which jobs actually run.
Monitoring Failed Jobs
Failed jobs are stored in the failed_jobs table. View them with:
php artisan queue:failed
Retry a specific failed job:
php artisan queue:retry {id}
Retry all failed jobs:
php artisan queue:retry all
Dry-Run Mode
Each sync target has an is_dry_run toggle. When enabled, the sync job processes all data but does not write to the destination (Algolia index, WooCommerce database, or HTTP endpoint). All log entries still record attempted/processed counts for verification.
Enable dry-run mode from the Sync Targets admin resource before testing configuration changes in production.