You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pub/Sub subscriptions don't bind to the specified topic as stated in documentation #2341
Can a helper subscription method be added in the gcloud.pubsub.client.Client class to facilitate subscribing to subscriptions similar to how there's a topic method to facilitate creating topics. Current instructions for receiving pull messages suggest invoking the gcloud.pubsub.topic.Topic.subscription method which creates a subscription bound to the specified topic as follows:
The gcloud.pubsub.topic.Topic.subscription documentation stating "Creates a subscription bound to the current topic" is misleading because it seems it binds to all topics.
Traceback (most recent call last):
File "./suball.py", line 8, in <module>
subscription.create()
File "/usr/local/lib/python3.4/dist-packages/google/cloud/pubsub/subscription.py", line 185, in create
self.full_name, self.topic.full_name, self.ack_deadline,
AttributeError: 'NoneType' object has no attribute 'full_name'
If you leave out the subscription.create() part your get:
Traceback (most recent call last):
File "./suball.py", line 16, in <module>
results = subscription.pull(return_immediately=True, max_messages=10)
File "/usr/local/lib/python3.4/dist-packages/google/cloud/pubsub/subscription.py", line 328, in pull
self.full_name, return_immediately, max_messages)
File "/usr/local/lib/python3.4/dist-packages/google/cloud/pubsub/_gax.py", line 418, in subscription_pull
raise NotFound(subscription_path)
google.cloud.exceptions.NotFound: 404 projects/<project>/subscriptions/all
Having a subscription for all topics would be nice to work around the performance issues with pulling from many topics.
Creating a Topic instance with a non-existent name and then using it to create a Subscription instance is a pointless exercise: its create() and pull() method will raise NotFound:
Activity
tseaver commentedon Sep 17, 2016
@georgegiovanni Thanks for the report!
ensonic commentedon Feb 23, 2017
It doesn't really work:
if you do this you get:
If you leave out the subscription.create() part your get:
Having a subscription for all topics would be nice to work around the performance issues with pulling from many topics.
tseaver commentedon Feb 23, 2017
The back-end does not provide an API method for creating a subscription which binds to multiple topics.
Not passing a topic to the
Subscriptionconstructor (or passingNone) indicates that the topic for the subscription no longer exists. The only useful thing one can do with such an instance is to call itsdelete()method.Creating a
Topicinstance with a non-existent name and then using it to create aSubscriptioninstance is a pointless exercise: itscreate()andpull()method will raiseNotFound:chore(python): conditionally load credentials in .kokoro/build.sh (#2341
refactor: fix SQLGlot doctests on the window, ai, to_json ops (#2341)