public interface TextFormat<V>
When using http, the carrier of propagated data on both the client (injector) and server (extractor) side is usually an http request. Propagation is usually implemented via library- specific request interceptors, where the client-side injects values and the server-side extracts them.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
TextFormat.Getter<C>
Interface that allows a
TextFormat to read propagated fields from a carrier. |
static interface |
TextFormat.Setter<C>
Class that allows a
TextFormat to set propagated fields into a carrier. |
| Modifier and Type | Method and Description |
|---|---|
<C> V |
extract(C carrier,
TextFormat.Getter<C> getter)
Extracts the value from upstream.
|
List<String> |
fields()
The propagation fields defined.
|
<C> void |
inject(V value,
C carrier,
TextFormat.Setter<C> setter)
Injects the value downstream.
|
List<String> fields()
inject(Object, Object, Setter) )}.
For example, if the carrier is a single-use or immutable request object, you don't need to clear fields as they couldn't have been set before. If it is a mutable, retryable object, successive calls should clear these fields first.
<C> void inject(V value, C carrier, TextFormat.Setter<C> setter)
C - carrier of propagation fields, such as an http requestvalue - the value to be injected.carrier - holds propagation fields. For example, an outgoing message or http request.setter - invoked for each propagation key to add or remove.<C> V extract(C carrier, TextFormat.Getter<C> getter)
If the value could not be parsed, the underlying implementation will decide to return ether an empty value, an invalid value, or a valid value.
C - carrier of propagation fields, such as an http request.carrier - holds propagation fields. For example, an outgoing message or http request.getter - invoked for each propagation key to get.