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 Details

    • send

      void send(MessageWriter messageWriter, Consumer<HttpResponse> onResponse, Consumer<Throwable> onError)
      Send an HTTP request, including any retry attempts. onResponse is called with the HTTP response, either a success response or an error response after retries. onError is called when the request could not be executed due to cancellation, connectivity problems, or timeout.
      Parameters:
      messageWriter - the request body message writer
      onResponse - the callback to invoke with the HTTP response
      onError - the callback to invoke when the HTTP request could not be executed
    • shutdown

      Shutdown the sender.