Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix
Class HystrixCommand.Setter

java.lang.Object
  extended by com.netflix.hystrix.HystrixCommand.Setter
Enclosing class:
HystrixCommand<R>

@NotThreadSafe
public static class HystrixCommand.Setter
extends java.lang.Object

Fluent interface for arguments to the HystrixCommand constructor.

The required arguments are set via the 'with' factory method and optional arguments via the 'and' chained methods.

Example:

 Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("GroupName"))
                .andCommandKey(HystrixCommandKey.Factory.asKey("CommandName"))
                .andEventNotifier(notifier);
  


Method Summary
 HystrixCommand.Setter andCommandKey(HystrixCommandKey commandKey)
           
 HystrixCommand.Setter andCommandPropertiesDefaults(HystrixCommandProperties.Setter commandPropertiesDefaults)
          Optional
 HystrixCommand.Setter andThreadPoolKey(HystrixThreadPoolKey threadPoolKey)
           
 HystrixCommand.Setter andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter threadPoolPropertiesDefaults)
          Optional
static HystrixCommand.Setter withGroupKey(HystrixCommandGroupKey groupKey)
          Setter factory method with required values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

withGroupKey

public static HystrixCommand.Setter withGroupKey(HystrixCommandGroupKey groupKey)
Setter factory method with required values.

All optional arguments can be set via the chained methods.

Parameters:
groupKey - HystrixCommandGroupKey used to group together multiple HystrixCommand objects.

The HystrixCommandGroupKey is used to represent a common relationship between commands. For example, a library or team name, the system all related commands interace with, common business purpose etc.


andCommandKey

public HystrixCommand.Setter andCommandKey(HystrixCommandKey commandKey)
Parameters:
commandKey - HystrixCommandKey used to identify a HystrixCommand instance for statistics, circuit-breaker, properties, etc.

By default this will be derived from the instance class name.

NOTE: Every unique HystrixCommandKey will result in new instances of HystrixCircuitBreaker, HystrixCommandMetrics and HystrixCommandProperties. Thus, the number of variants should be kept to a finite and reasonable number to avoid high-memory usage or memory leacks.

Hundreds of keys is fine, tens of thousands is probably not.

Returns:
Setter for fluent interface via method chaining

andThreadPoolKey

public HystrixCommand.Setter andThreadPoolKey(HystrixThreadPoolKey threadPoolKey)
Parameters:
threadPoolKey - HystrixThreadPoolKey used to define which thread-pool this command should run in (when configured to run on separate threads via HystrixCommandProperties.executionIsolationStrategy()).

By default this is derived from the HystrixCommandGroupKey but if injected this allows multiple commands to have the same HystrixCommandGroupKey but different thread-pools.

Returns:
Setter for fluent interface via method chaining

andCommandPropertiesDefaults

public HystrixCommand.Setter andCommandPropertiesDefaults(HystrixCommandProperties.Setter commandPropertiesDefaults)
Optional

Parameters:
commandPropertiesDefaults - HystrixCommandProperties.Setter with property overrides for this specific instance of HystrixCommand.

See the HystrixPropertiesStrategy JavaDocs for more information on properties and order of precedence.

Returns:
Setter for fluent interface via method chaining

andThreadPoolPropertiesDefaults

public HystrixCommand.Setter andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter threadPoolPropertiesDefaults)
Optional

Parameters:
threadPoolPropertiesDefaults - HystrixThreadPoolProperties.Setter with property overrides for the HystrixThreadPool used by this specific instance of HystrixCommand.

See the HystrixPropertiesStrategy JavaDocs for more information on properties and order of precedence.

Returns:
Setter for fluent interface via method chaining