alexeevdv / yii2-queue-checker
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ^2.0
- yiisoft/yii2-queue: ^2.1
Requires (Dev)
Suggests
- mikk150/yii2-sms: Allows to send alarms via SMS
This package is auto-updated.
Last update: 2024-10-20 01:10:24 UTC
README
Usage example
<?php return [ // ... 'components' => [ 'smsProvider' => [ 'class' => \mikk150\sms\ProviderInterface::class, ], 'mailer' => [ 'class' => \yii\mail\MailerInterface::class, ], ], 'controllerMap' => [ 'queue-checker' => [ 'class' => \alexeevdv\yii\queue\checker\CheckController::class, 'checkActionConfig' => [ 'class' => \alexeevdv\yii\queue\checker\CheckAction::class, 'alarms' => [ [ 'class' => \alexeevdv\yii\queue\checker\SmsAlarm::class, 'provider' => 'smsProvider', 'from' => 'Queue', 'to' => [ '+123456789', '+987654321', ], ], [ 'class' => \alexeevdv\yii\queue\checker\MailerAlarm::class, 'subject' => 'Queue status notication', 'from' => 'Queue', 'to' => [ 'admin@example.org', 'suppoer@example.org', ], ], ], ], ], ], // ... ];
./yii queue-checker
Custom alarm example
<?php namespace common\components; use alexeevdv\yii\queue\checker\AlarmInterface; use yii\base\BaseObject; use yii\di\Instance; use yii\httpclient\Client; class WebhookAlarm extends BaseObject implements AlarmInterface { public $httpClient = Client::class; public $webHook; public function send($downtime) { Instance::ensure($this->httpClient, Client::class)->post($this->webhook, [ 'downtime' => $downtime, ]); } }
<?php return [ // ... 'controllerMap' => [ 'queue-checker' => [ 'class' => \alexeevdv\yii\queue\checker\CheckController::class, 'checkActionConfig' => [ 'class' => \alexeevdv\yii\queue\checker\CheckAction::class, 'alarms' => [ [ 'class' => \common\components\WebhookAlarm::class, 'webhook' => 'http://your-webhook-here', ], ], ], ], ], // ... ];