Annotation Interface OfMDC
On the client side, applied to a parameter on a ByJms interface, it specifies the key and value for MDC.
On the server side, applied to a parameter of a ForJmsType Invoking method, it specifies the supplier parameter for the value of the named context.
When applied to a parameter, the context value will be supplied by the argument via Object.toString().
The annotation can also be applied to a supplier method defined by the type of the body parameter on either the client side and the server side. The supplier method must
- be declared on the type directly, no recursion or inheritance
public- have no parameter
- return a value
null, will be converted to
String via Object.toString(). If no name is
specified by the annotation, the method name will be used as the context key.
Note that there is only one MDC for each thread. If there is an existing context on the thread, it will be overwritten by the new value from the annotation. After execution, the all keys will be removed resulting the lose of the original values.
In case of a name collision, the following defines the precedence from high to low:
- supplier methods from body argument
- body argument itself
- other arguments, e.g., headers and properties
- Since:
- 3.0.0
- Author:
- Lei Yang
- See Also:
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional Elements
-
Element Details