Page Name: pubsub-topic
Release: 0.18.1
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:
pubsub_client = pubsub.Client()
topic = pubsub_client.topic(topic_name)
subscription = topic.subscription(subscription_name)
results = subscription.pull(return_immediately=True)
However a non-existent topic name can be supplied for topic_name and messages can still be received from the results.
The following code also works without having to specify a topic:
pubsub_client = pubsub.Client()
subscription = pubsub.subscription.Subscription(subscription_name, client=pubsub_client)
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.
Page Name: pubsub-topic
Release: 0.18.1
Can a helper
subscriptionmethod be added in thegcloud.pubsub.client.Clientclass to facilitate subscribing to subscriptions similar to how there's atopicmethod to facilitate creating topics. Current instructions for receiving pull messages suggest invoking thegcloud.pubsub.topic.Topic.subscriptionmethod which creates a subscription bound to the specified topic as follows:However a non-existent topic name can be supplied for
topic_nameand messages can still be received from theresults.The following code also works without having to specify a topic:
The
gcloud.pubsub.topic.Topic.subscriptiondocumentation stating "Creates a subscription bound to the current topic" is misleading because it seems it binds to all topics.