Reputation: 49
Currently, we're working on a spring boot application in a GCP project, which connects to a PubSub endpoint in the same GCP project, but also to a PubSub endpoint in another GCP project. I want to use plain spring cloud GCP PubSub components, but with those, I have no chance to set a second PubSub connection to a second GCP project. Also, if I would have one service account, with PubSubTemplate object I have no possibility to target a topic in another project than the current from the service account. Is the only way to implement/extend the PubSubAdmin/PubSubTemplate or is there also a solution like multiple connection and template for JPA databases?
Kind Regards Sven
Upvotes: 2
Views: 2088
Reputation: 1210
Considering correct privileges for another project,you can publish/subscribe to topics in different projects with a fully qualified topic/subscription name
eg. for topic publish pubSubTemplate.publish("projects/other-project/topics/the-topic", "payload")
.
This should be available with the latest spring-cloud-gcp
version. Please see this issue for more details.
Upvotes: 2