yucadoo / bgy-neighborhoods-diagnostic
使用Neighborhoods的可抛诊断组件,为Boris Guéry的瞬态错误处理提供错误检测策略。
0.0.1
2020-10-18 16:32 UTC
Requires
- php: ^7.3
- borisguery/transient-error-handling: ^0.4.0
- neighborhoods/throwable-diagnostic-component: ^2.1
Requires (Dev)
- phpunit/phpunit: >=8.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-09-19 01:12:48 UTC
README
使用Boris Guéry的瞬态错误处理和Neighborhoods的可抛诊断组件进行错误检测的策略。
安装
通过Composer
$ composer require yucadoo/bgy-neighborhoods-diagnostic
用法
use Bgy\TransientFaultHandling\RetryPolicy; use Bgy\TransientFaultHandling\RetryStrategies\FixedInterval; use YucaDoo\BgyNeighborhoodsDiagnostic\ExceptionDetectionStrategy as NeighborhoodsErrorDetectionStrategy; /** * Obtain a preconfigured ThrowableDiagnostic builder factory. * You can use Symfony DI as explained in Neighborhoods' throwable diagnostic component. */ $throwableDiagnosticBuilderFactory = $container->get('ThrowableDiagnosticBuilderFactoryWithTailoredDecoratorStack'); $neighborhoodsErrorDetectionStrategy = new NeighborhoodsErrorDetectionStrategy(); $neighborhoodsErrorDetectionStrategy->setThrowableDiagnosticBuilderFactory($throwableDiagnosticBuilderFactory); // Compose retry policy $retryCount = 10; $retryIntervalInMicroseconds = 1000000 // 1 sec $retryStrategy = new FixedInterval($retryCount, $retryIntervalInMicroseconds); $retryPolicy = new RetryPolicy($neighborhoodsErrorDetectionStrategy, $retryStrategy); $retryPolicy->execute(function() { // API calls // Database calls });
测试
$ composer test
贡献
请参阅CONTRIBUTING和CODE_OF_CONDUCT以获取详细信息。
安全
如果您发现任何安全相关的问题,请通过hrcajuka@gmail.com发送电子邮件,而不是使用问题跟踪器。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。