googleapis / googleapis/google-cloud-ruby

`Google::Cloud::PubSub::ReceivedMessage#subscription` returns both subscription and stream

Open
#22,438 2 comments 0 reactions 1 assignee Assigned to @shivgautam View on GitHub
priority: p3 type: feature request
Dominant language
Ruby
Stars
1.4k
Forks
578
Avg merge
1d 11h
Merged PRs (30d)
166

Description

If you receive a message via streaming pull, `ReceivedMessage#subscription` returns the subscriber stream, meaning that if you want to grab the subscription name from it you have to do something like:
```ruby
received_message.subscription.subscriber.subscription_name
```
But if you use the regular pull operation or the `wait_for_messages` method, `ReceivedMessage#subscription` now returns the actual subscription, meaning that the previous line crashes since subscription does not have a subscriber.

Is it possible that both return a subscription? So the streaming pull instead of returning a stream it returns a subscription as the name suggests.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.