# `BroadwayCloudPubSub.Streaming.GrpcClient`
[🔗](https://github.com/dashbitco/broadway_cloud_pub_sub/blob/v2.0.0-rc.0/lib/broadway_cloud_pub_sub/streaming/grpc_client.ex#L1)

The default gRPC client for `BroadwayCloudPubSub.Producer`.

Implements `BroadwayCloudPubSub.Streaming.Client` using the `grpc` library
with the `Google.Pubsub.V1.Subscriber.Stub` generated stub.

This module handles:
- Token fetching and channel connection (with TLS and adapter configuration)
- Bidirectional `StreamingPull` stream management
- Unary `Acknowledge` and `ModifyAckDeadline` RPCs with telemetry spans

## Telemetry

This module emits the following telemetry events:

* `[:broadway_cloud_pub_sub, :streaming, :grpc_client, :ack, :start | :stop | :exception]` —
  emitted as a span when sending an `Acknowledge` unary RPC.

  Measurements: as described in `:telemetry.span/3`.
  Metadata: `%{name: broadway_name, subscription: subscription, count: ack_count}`

* `[:broadway_cloud_pub_sub, :streaming, :grpc_client, :modack, :start | :stop | :exception]` —
  emitted as a span when sending a `ModifyAckDeadline` unary RPC.

  Measurements: as described in `:telemetry.span/3`.
  Metadata: `%{name: broadway_name, subscription: subscription, count: ack_count}`

Custom `BroadwayCloudPubSub.Streaming.Client` implementations that wish to emit
the same events should use the same event name prefix and metadata shape.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
