How to wire/configure two pubsub gcp projects in one spring boot application with spring cloud?
Asked Answered
B

1

2

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

Bohannon answered 1/8, 2019 at 20:38 Comment(0)
R
2

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.

Renae answered 19/9, 2019 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.