PHP 클래스 Odesk\Phystrix\AbstractCommand

파일 보기 프로젝트 열기: odesk/phystrix

보호된 프로퍼티들

프로퍼티 타입 설명
$commandKey string Command Key, used for grouping Circuit Breakers
$config Zend\Config\Config Command configuration
$serviceLocator Zend\Di\LocatorInterface

공개 메소드들

메소드 설명
execute ( ) : mixed Executes the command Isolation and fault tolerance logic (Circuit Breaker) is built-in
getCommandKey ( ) : string Determines and returns command key, used for circuit breaker grouping and metrics tracking
getExecutionEvents ( ) : array Returns events collected
getExecutionException ( ) : Exceptio\Exception | null Returns exception thrown while executing the command, if there was any
getExecutionTimeInMilliseconds ( ) : null | integer Returns execution time in milliseconds, null if not executed
initializeConfig ( Zend\Config\Config $phystrixConfig ) Sets base command configuration from the global phystrix configuration
setCircuitBreakerFactory ( Odesk\Phystrix\CircuitBreakerFactory $circuitBreakerFactory ) Sets instance of circuit breaker factory
setCommandMetricsFactory ( Odesk\Phystrix\CommandMetricsFactory $commandMetricsFactory ) Sets instance of command metrics factory
setConfig ( Zend\Config\Config $config, boolean $merge = true ) Sets configuration for the command, allows to override config in runtime
setRequestCache ( RequestCache $requestCache ) Sets shared object for request caching
setRequestLog ( Odesk\Phystrix\RequestLog $requestLog ) Sets shared object for request logging
setServiceLocator ( Zend\Di\LocatorInterface $serviceLocator ) Sets service locator instance, for injecting custom dependencies into the command

보호된 메소드들

메소드 설명
getCacheKey ( ) : string | null Key to be used for request caching.
getFallback ( ) Code for when execution fails for whatever reason
prepare ( ) Custom preparation logic, preceding command execution
processExecutionEvent ( string $eventName ) Custom logic proceeding event generation
run ( ) : mixed The code to be executed

비공개 메소드들

메소드 설명
getCircuitBreaker ( ) : Odesk\Phystrix\CircuitBreaker Circuit breaker for this command key
getFallbackOrThrowException ( Exception $originalException = null ) : mixed Attempts to retrieve fallback by calling getFallback
getMetrics ( ) : Odesk\Phystrix\CommandMetrics Command Metrics for this command key
getTimeInMilliseconds ( ) : float Returns current time on the server in milliseconds
isRequestCacheEnabled ( ) : boolean Determines whether request caching is enabled for this command
recordExecutedCommand ( ) Adds reference to the command to the current request log
recordExecutionEvent ( string $eventName ) Logic to record events and exceptions as they take place
recordExecutionTime ( ) Records command execution time if the command was executed, not short-circuited and not returned from cache

메소드 상세

execute() 공개 메소드

Executes the command Isolation and fault tolerance logic (Circuit Breaker) is built-in
public execute ( ) : mixed
리턴 mixed

getCacheKey() 보호된 메소드

By default this return null, which means "do not cache". To enable caching, override this method and return a string key uniquely representing the state of a command instance. If multiple command instances are executed within current HTTP request, only the first one will be executed and all others returned from cache.
protected getCacheKey ( ) : string | null
리턴 string | null

getCommandKey() 공개 메소드

Determines and returns command key, used for circuit breaker grouping and metrics tracking
public getCommandKey ( ) : string
리턴 string

getExecutionEvents() 공개 메소드

Returns events collected
public getExecutionEvents ( ) : array
리턴 array

getExecutionException() 공개 메소드

Returns exception thrown while executing the command, if there was any
public getExecutionException ( ) : Exceptio\Exception | null
리턴 Exceptio\Exception | null

getExecutionTimeInMilliseconds() 공개 메소드

Returns execution time in milliseconds, null if not executed

getFallback() 보호된 메소드

Code for when execution fails for whatever reason
protected getFallback ( )

initializeConfig() 공개 메소드

Sets base command configuration from the global phystrix configuration
public initializeConfig ( Zend\Config\Config $phystrixConfig )
$phystrixConfig Zend\Config\Config

prepare() 보호된 메소드

Custom preparation logic, preceding command execution
protected prepare ( )

processExecutionEvent() 보호된 메소드

Custom logic proceeding event generation
protected processExecutionEvent ( string $eventName )
$eventName string

run() 추상적인 보호된 메소드

The code to be executed
abstract protected run ( ) : mixed
리턴 mixed

setCircuitBreakerFactory() 공개 메소드

Sets instance of circuit breaker factory
public setCircuitBreakerFactory ( Odesk\Phystrix\CircuitBreakerFactory $circuitBreakerFactory )
$circuitBreakerFactory Odesk\Phystrix\CircuitBreakerFactory

setCommandMetricsFactory() 공개 메소드

Sets instance of command metrics factory
public setCommandMetricsFactory ( Odesk\Phystrix\CommandMetricsFactory $commandMetricsFactory )
$commandMetricsFactory Odesk\Phystrix\CommandMetricsFactory

setConfig() 공개 메소드

Sets configuration for the command, allows to override config in runtime
public setConfig ( Zend\Config\Config $config, boolean $merge = true )
$config Zend\Config\Config
$merge boolean

setRequestCache() 공개 메소드

Sets shared object for request caching
public setRequestCache ( RequestCache $requestCache )
$requestCache RequestCache

setRequestLog() 공개 메소드

Sets shared object for request logging
public setRequestLog ( Odesk\Phystrix\RequestLog $requestLog )
$requestLog Odesk\Phystrix\RequestLog

setServiceLocator() 공개 메소드

Sets service locator instance, for injecting custom dependencies into the command
public setServiceLocator ( Zend\Di\LocatorInterface $serviceLocator )
$serviceLocator Zend\Di\LocatorInterface

프로퍼티 상세

$commandKey 보호되어 있는 프로퍼티

Command Key, used for grouping Circuit Breakers
protected string $commandKey
리턴 string

$config 보호되어 있는 프로퍼티

Command configuration
protected Config,Zend\Config $config
리턴 Zend\Config\Config

$serviceLocator 보호되어 있는 프로퍼티

protected LocatorInterface,Zend\Di $serviceLocator
리턴 Zend\Di\LocatorInterface