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 Summary
Modifier and TypeMethodDescriptionvoidsend(MessageWriter messageWriter, Consumer<GrpcResponse> onResponse, Consumer<Throwable> onError) Execute a gRPC unary call, including any retry attempts.shutdown()Shutdown the sender.
-
Method Details
-
send
void send(MessageWriter messageWriter, Consumer<GrpcResponse> onResponse, Consumer<Throwable> onError) Execute a gRPC unary call, including any retry attempts.onResponseis called with the gRPC response, either a success response or an error response after retries.onErroris 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 mostGrpcSenderConfig.getMaxResponseBodySize()bytes.- Parameters:
messageWriter- the message writeronResponse- the callback to invoke with the gRPC responseonError- the callback to invoke when the gRPC call could not be executed
-
shutdown
CompletableResultCode shutdown()Shutdown the sender.
-