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_nameDefault:incident_monitor_createqueue_groupDefault:incident-monitorqueue_max_attemptsDefault:3queue_retry_delay_secondsDefault:60queue_rate_limit_per_minuteDefault:60queue_rate_limit_key_prefixDefault:incident-monitor-rate
Failure handling¶
When a queued job fails:
- it is rescheduled with backoff
- it retries until
queue_max_attemptsis reached - the final exception is rethrown so Action Scheduler can mark the job failed