Skip to content

Async Queue

If Action Scheduler is available, ticket creation can be queued instead of running inline.

Queue via facade

<?php

use Subscribed\IncidentMonitor\Facade\IncidentMonitorFacade;

IncidentMonitorFacade::queueFor(
    'asana',
    'customer-service',
    'Uncaptured payments detected',
    'Payment 12345 was authorized but not captured.',
    'asana-user-id',
    ['incident', 'payments'],
    null,
    ['fingerprint' => 'payments/not-captured/12345']
);

Safe async usage:

<?php

$jobId = IncidentMonitorFacade::tryQueueFor(
    'asana',
    'customer-service',
    'Uncaptured payments detected',
    'Payment 12345 was authorized but not captured.',
    null,
    [],
    null,
    ['fingerprint' => 'payments/not-captured/12345']
);

If null is returned, the package is not bootstrapped or Action Scheduler is unavailable.

WP-CLI exposes the same queue path:

wp subscribed incidents queue "Uncaptured payments detected" "Payment 12345 was authorized but not captured." \
  --connector=asana \
  --project-key=customer-service \
  --fingerprint=payments/not-captured/12345

Configuration

  • queue_action_name Default: incident_monitor_create
  • queue_group Default: incident-monitor
  • queue_max_attempts Default: 3
  • queue_retry_delay_seconds Default: 60
  • queue_rate_limit_per_minute Default: 60
  • queue_rate_limit_key_prefix Default: incident-monitor-rate

Failure handling

When a queued job fails:

  • it is rescheduled with backoff
  • it retries until queue_max_attempts is reached
  • the final exception is rethrown so Action Scheduler can mark the job failed