简体   繁体   中英

Unable to Pull messages from a pubsub topic/subscription from another project

I am new to GCP. My Use case involves reading(PULL) the data from multiple pub-sub subscriptions present in multiple different projects say (A, B, C) to another project say D. I read the documentation for access control in pub-sub. Following that, I tried binding service accounts of project A, B, C (which has publisher/subscriber role) to the topic that is present on project D. After this I tried to pull messages from a subscription present in project A, using "gcloud" command from project D ("gcloud pubsub subscriptions pull [SUBSCRIPTION_NAME_IN_PROJECT_A"), and I am still not able to fetch the result and getting an error as "NOT_FOUND: Resource not found".

Can somebody please help me as how to achieve cross-project communication in pub-sub.

You need to specify the project with the flag --project . If you do not then it looks for the subscription in the same project you are running the command. More details here

gcloud pubsub subscriptions pull <subs-name project A> --project=<projectId A>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM