odesk/phystrix-bundle

Phystrix 与 Symfony2 框架的集成。

安装数量: 26,882

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 24

分支: 0

开放性问题: 1

类型:symfony-bundle

v1.1.8 2016-07-11 18:26 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:50:20 UTC


README

SensioLabsInsight Build Status Scrutinizer Code Quality

Phystrix Bundle

此包提供默认配置的 phystrix 命令工厂服务:phystrix.command_factory

安装

使用 Composer 安装组件。更新您的项目 composer.json 文件以包含依赖项。

"require": {
    "odesk/phystrix-bundle": "~1.1"
}

在您的 AppKernel 中注册包

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Odesk\Bundle\PhystrixBundle\OdeskPhystrixBundle()
            // ...
        );
    }
}

配置

默认配置

app/config/config.yml

odesk_phystrix:
  default:
    fallback: ~
    circuitBreaker:
      errorThresholdPercentage: 50
      forceOpen: false
      forceClosed: false
      requestVolumeThreshold: 20
      sleepWindowInMilliseconds: 5000
    metrics:
      healthSnapshotIntervalInMilliseconds: 1000
      rollingStatisticalWindowInMilliseconds: 10000
      rollingStatisticalWindowBuckets: 10
    requestCache: ~
    requestLog: ~

Web Profiler

Phystrix 包附带一个 Web Profiler 插件,当启用 Symfony Profiler 时会自动启用。您只需确保请求日志功能已开启

odesk_phystrix:
  default:
    requestLog:
      enabled: true

仅在配置器激活的模式/环境中执行此操作。

使用方法

您可以使用 phystrix.service_locator 在运行时提供额外的依赖项

$container->get('phystrix.service_locator')->set('somekey', $somevalue);

如何创建和运行一个命令

$command = $container->get('phystrix.command_factory')->getCommand('MyCommand', $parameter1, $parameter2);
$command->execute();

许可证

此文件是 Phystrix Bundle 的一部分

版权所有 2013-2017 Upwork Global Inc. 保留所有权利。

此文件根据 Apache License 2.0 许可(“许可证”);除非根据适用法律或书面协议,否则不得使用此文件。您可以在以下位置获取许可证副本:

https://apache.ac.cn/licenses/LICENSE-2.0

除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”提供,不提供任何明示或暗示的保证或条件。有关许可证的具体语言、许可权限和限制,请参阅许可证。