In my GCP project (project A) I have created a Pub/sub topic (topicA) and messages published in this pub/sub topic needs to be consumed in other GCP project (project B) by Subscription (subscriptionB).
What's the recommended way of setting up subscriptionB ?
- Define subscriptionB in project A and add service account from project B with appropriate IAM permission.
- Define subscriptionB in project B. In cloud console it's possible to attach subscription from different topic by granting pubsub.topic.attachSubscription (shown below).
Is approach 2 even possible ? If yes, then when to use approach 2 and what all needs to be done for approach 2 ?