Interface GrpcSender


public interface GrpcSender
An abstraction for executing gRPC calls, 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<GrpcResponse> onResponse, Consumer<Throwable> onError)
      Execute a gRPC unary call, including any retry attempts. onResponse is called with the gRPC response, either a success response or an error response after retries. onError is called when the call could not be executed due to cancellation, connectivity problems, or timeout.

      The byte array returned by GrpcResponse.getResponseMessage() should contain at most GrpcSenderConfig.getMaxResponseBodySize() bytes.

      Parameters:
      messageWriter - the message writer
      onResponse - the callback to invoke with the gRPC response
      onError - the callback to invoke when the gRPC call could not be executed
    • shutdown

      Shutdown the sender.