Interface HttpSender
public interface HttpSender
An abstraction for executing HTTP requests, allowing for implementations backed by different
client libraries.
While this interface is public, implementing a custom sender is generally not recommended. The
opentelemetry-java project provides built-in implementations that cover virtually all
cases.
- Since:
- 1.59.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidsend(MessageWriter messageWriter, Consumer<HttpResponse> onResponse, Consumer<Throwable> onError) Send an HTTP request, including any retry attempts.shutdown()Shutdown the sender.
-
Method Details
-
send
void send(MessageWriter messageWriter, Consumer<HttpResponse> onResponse, Consumer<Throwable> onError) Send an HTTP request, including any retry attempts.onResponseis called with the HTTP response, either a success response or an error response after retries.onErroris called when the request could not be executed due to cancellation, connectivity problems, or timeout.The byte array returned by
HttpResponse.getResponseBody()should contain at mostHttpSenderConfig.getMaxResponseBodySize()bytes.- Parameters:
messageWriter- the request body message writeronResponse- the callback to invoke with the HTTP responseonError- the callback to invoke when the HTTP request could not be executed
-
shutdown
CompletableResultCode shutdown()Shutdown the sender.
-