Interface HttpEndpointSupplier
-
- All Superinterfaces:
Closeable
- All Known Subinterfaces:
HttpEndpointSupplier.Constant
public interface HttpEndpointSupplier extends Closeable
HTTP-basedsenders, such as BaseHttpSender use this to get the endpoint to POST spans to. For example, http://localhost:9411/api/v2/spansThese are created by a HttpEndpointSupplier.Factory, allows this to be constructed with a potentially-pseudo endpoint passed by configuration.
The simplest implementation is a HttpEndpointSupplier.Constant, which is called only once. The easiest way to create constants is to use
HttpEndpointSuppliers.constantFactory()orHttpEndpointSuppliers.newConstant(String).Those using dynamic implementations that make remote calls should consider wrapping with
HttpEndpointSuppliers.newRateLimitedFactory(Factory, int)orHttpEndpointSuppliers.newRateLimited(HttpEndpointSupplier, int)to avoid excessive errors or overhead by calling the backend in a tight loop.Implementation Notes
BaseHttpSender is a convenience type that implements the following logic:- During build, the sender should invoke the HttpEndpointSupplier.Factory.
- If the result is
HttpEndpointSupplier.Constant, build the sender to use a static value. - Otherwise, call
get()each time BytesMessageSender.send(List) is invoked. - Call
Closeable.close()once duringCloseable.close().
Implement friendly
toString()functions, that include the real endpoint or the one passed to the HttpEndpointSupplier.Factory.Senders are not called during production requests, rather in time or size bounded loop, in a separate async reporting thread. Implementations that resolve endpoints via remote calls, such as from Eureka, should cache internally to avoid blocking the reporter thread on each loop.
Some senders, such as Armeria, may have more efficient and precise endpoint group logic. In scenarios where the sender is known, interfaces here may be used as markers. Doing so can satisfy dependency injection, without limiting an HTTP framework that can handle groups, to a single-endpoint supplier.
- Since:
- 3.3
- See Also:
BaseHttpSender,HttpEndpointSupplier.Constant,HttpEndpointSuppliers
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceHttpEndpointSupplier.ConstantHTTPsenderscheck for this type, and will cache its first value.static interfaceHttpEndpointSupplier.FactoryFactory passed to HTTPsenderbuilders to control resolution of the static endpoint from configuration.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stringget()Returns a possibly cached endpoint to an HTTPsender.
-
-
-
Method Detail
-
get
String get()
Returns a possibly cached endpoint to an HTTPsender.This will be called inside BytesMessageSender.send(List), unless this is an instance of HttpEndpointSupplier.Constant.
- Since:
- 3.3
-
-