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

怎甘沉沦 提交于 2019-12-11 15:36:58

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/57316667/how-to-wire-configure-two-pubsub-gcp-projects-in-one-spring-boot-application-wit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!