Skip to content

PubSub Client: list_subscriptions returns all subscriptions, not just for that topic #4426

@anorth2

Description

@anorth2
  1. OS type and version
    Any and all

  2. Python version and virtual environment information python --version
    Python 3.6.3

  3. google-cloud-python version pip show google-cloud, pip show google-<service> or pip freeze
    google==1.9.3
    google-api-core==0.1.1
    google-auth==1.2.1
    google-cloud-core==0.28.0
    google-cloud-pubsub==0.29.0
    google-gax==0.15.16
    googleapis-common-protos==1.5.3
    grpc-google-iam-v1==0.11.4

  4. Stacktrace if available

  5. Steps to reproduce
    Run example code for listing subscriptions for a topic from here:
    https://cloud.google.com/pubsub/docs/admin

  6. Code example

def list_subscriptions_in_topic(project, topic_name):
    """Lists all subscriptions for a given topic."""
    subscriber = pubsub_v1.SubscriberClient()
    topic_path = subscriber.topic_path(project, topic_name)

    for subscription in subscriber.list_subscriptions(topic_path):
        print(subscription.name)

topic path being used as shown by topic_path = subscriber.topic_path(project, topic_name):
projects/my-team-dev/topics/testing-topic

Using GitHub flavored markdown can help make your request clearer.
See: https://guides.github.com/features/mastering-markdown/

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.status: investigatingThe issue is under investigation, which is determined to be non-trivial.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions