이 패키지는 대기 중인 작업이 실패할 경우 알림을 보냅니다. 기본적으로 메일 및/또는 Slack을 통해 알림을 보낼 수 있습니다. 이는 Laravel의 기본 알림 시스템을 활용합니다.
우리는 동급 최고의 오픈 소스 패키지를 만드는 데 많은 리소스를 투자합니다. 유료 제품 중 하나를 구매하여 우리를 지원할 수 있습니다.
귀하가 사용하고 있는 당사 패키지를 언급하면서 귀하의 고향에서 엽서를 보내주셔서 진심으로 감사드립니다. 연락처 페이지에서 주소를 확인하실 수 있습니다. 우리는 수신된 모든 엽서를 가상 엽서 월에 게시합니다.
Laravel 버전 5.8 및 6.x의 경우 이 패키지의 v3.x를 사용하세요.
작곡가를 통해 패키지를 설치할 수 있습니다.
composer require spatie/laravel-failed-job-monitorSlack 알림을 사용하려면 guzzle 클라이언트도 설치해야 합니다.
composer require guzzlehttp/guzzle서비스 제공업체가 자동으로 등록됩니다.
다음으로 구성 파일을 게시해야 합니다.
php artisan vendor:publish --tag=failed-job-monitor-config이는 기본 구성 파일의 내용입니다. 여기에서 알림을 보내야 하는 알림 대상을 지정할 수 있습니다. 기본 알림 가능 항목은 이 구성 파일에 지정된 변수를 사용합니다.
return [
/ * *
* The notification that will be sent when a job fails .
* /
' notification ' => Spatie FailedJobMonitor Notification::class,
/ * *
* The notifiable to which the notification will be sent . The default
* notifiable will use the mail and slack configuration specified
* in this config file .
* /
' notifiable ' => Spatie FailedJobMonitor Notifiable::class,
/ *
* By default notifications are sent for all failures . You can pass a callable to filter
* out certain notifications . The given callable will receive the notification . If the callable
* return false , the notification will not be sent .
* /
' notificationFilter ' => null ,
/ * *
* The channels to which the notification will be sent .
* /
' channels ' => [ ' mail ' , ' slack ' ],
' mail ' => [
' to ' => [ ' [email protected] ' ],
],
' slack ' => [
' webhook_url ' => env ( ' FAILED_JOB_SLACK_WEBHOOK_URL ' ),
],
];이 패키지에서 제공하는 기본 알림 클래스는 메일 및 Slack을 지원합니다.
알림을 사용자 정의하려면 구성 파일에서 고유한 알림 클래스를 지정할 수 있습니다.
// config / failed - job - monitor . php
return [
...
' notification ' => App Notifications CustomNotificationForFailedJobMonitor::class,
... 이 패키지에서 제공하는 기본 알림 가능 클래스는 config 파일의 channels , mail 및 slack 키를 사용하여 알림 전송 방법을 결정합니다.
알림 가능 항목을 사용자 정의하려면 구성 파일에서 알림 가능 클래스를 직접 지정할 수 있습니다.
// config / failed - job - monitor . php
return [
' notifiable ' => App CustomNotifiableForFailedJobMonitor::class,
... 알림을 필터링하려면 notificationFilter 에 클로저를 전달하세요.
// config / failed - job - monitor . php
return [
...
' notificationFilter ' => function ( Spatie FailedJobMonitor Notification $ notification ): bool
{
return true ;
}
. . . 위의 내용은 Laravel이 클로저 직렬화를 지원하지 않는 경우에만 작동합니다. 따라서 php artisan config:cache 실행하면 다음 오류가 발생합니다.
LogicException : Your configuration files are not serializable.
따라서 별도의 클래스를 만들고 콜백을 콜백으로 사용하는 것이 더 좋습니다.
<?php
namespace App Notifications ;
use Spatie FailedJobMonitor Notification ;
class FailedJobNotification
{
public static function notificationFilter ( Notification $ notification ): bool
{
return true ;
}
}그리고 구성 파일에서 이를 참조하세요.
// config / failed - job - monitor . php
return [
...
' notificationFilter ' => [ App Notifications FailedJobNotification::class, ' notificationFilter ' ],
...패키지를 올바르게 구성했다면 완료된 것입니다. 대기 중인 작업이 실패하면 알림을 받게 됩니다.
최근 변경된 사항에 대한 자세한 내용은 CHANGELOG를 참조하세요.
composer test 자세한 내용은 CONTRIBUTING을 참조하세요.
보안 관련 버그를 발견한 경우 이슈 트래커를 사용하는 대신 [email protected]로 메일을 보내주세요.
패키지 v2 만드는 데 도움을 준 Egor Talantsev에게 큰 감사를 드립니다.
MIT 라이센스(MIT). 자세한 내용은 라이센스 파일을 참조하십시오.