Configuration - ThatJoeMoore/HysNotes GitHub Wiki
Most of the time, the output of this generation is more than sufficient. However, maybe you want it to be special. Maybe you don't like my auto-generated command names. Maybe you want things to live in a different package. Well, we can do that!
##Configuration Levels There are three levels at which you can configure the output from the processor: package, class, and method. Each level will override the settings of its more-generic counterpart, i.e, class settings override package ones and methods override classes and packages.
###Package
You can set up default values at a package level with @HysDefaults.
The processor searches for @HysDefaults starting at the package of the annotated class and moving up the package tree, stopping when it finds a package-info.class with the annotation. If the annotated package is not the same one the annotated class is in, it will only be used if the inherited
property of @HysDefaults is true
, which is the default.
###Class You've already seen @HysCommands being used to tell the processor to generate commands, but it is also used to configure those commands. These settings override the package-level ones, and offer several more options.
###Method The method-level @HysCommand configures an individual command.
##Configuration Options
###group
Package, Class, Method
default: Name of annotated class
The Hystrix Command Group. Defaults to the name of the class that has the @HysCommands or @HysCommand annotation.
###threadPool
- Not Yet Implemented
Package, Class, Method
default: Name of annotated class
The Hystrix Thread Pool. Defaults to the name of the class that has the @HysCommand or @HysCommand annotation.
###generatedPackage
Package, Class, Method
default: Package of annotated class
The package in which to place the generated classes. If on the method level, affects only the command for that method; at the class or package levels, affects all generated classes within the annotated scope.
###generateFacade
Package, Class
default: true
Whether or not to generate a facade class. If false
, only command classes will be generated.
###commandPrefix
Class
default: Name of the annotated class
The first part of the name of the generated command classes. By default, this matches the name of the annotated class from which the command is being generated. For example, if an interface MyInterface
has an annotated method named MyMethod
, the default name of the command class will be MyInterfaceMyMethodCommand
. However, if this option is set to 'FooBar', the generated command for MyMethod
would be FooBarMyMethodCommand
.
###facadeClass
Class
default: (Class Name)HystrixFacade
The name of the generated facade class, if generated. By default, it is the name of the annotated class with the suffix "HystrixFacade."
###commandName
Method
default: commandPrefix
(Method Name)Command
The name of the generated command class. By default, it is the concatenation of the value of commandPrefix
, the method name, and the suffix 'Command'. For more, see the documentation for commandPrefix
.
Next: Advanced Features