You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 19, 2022. It is now read-only.
PubsubTemplate publish to topics in other projects (#1678)
This change to the DefaultPublisherFactory allows the project id of the
topic to be overwitten directly from the topic specification in the
topic string.
This allows use-cases like
pubSubTemplate.publish("projects/other-project/topics/the-topic", "payload").
This change applied across the board to allow publishing, subscribing, creating,
and deleting topics using fully-qualified topic names.
Fixes#1678.
Copy file name to clipboardexpand all lines: docs/src/main/asciidoc/pubsub.adoc
+3
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ It provides the common set of operations needed to interact with Google Cloud Pu
39
39
40
40
`PubSubTemplate` provides asynchronous methods to publish messages to a Google Cloud Pub/Sub topic.
41
41
The `publish()` method takes in a topic name to post the message to, a payload of a generic type and, optionally, a map with the message headers.
42
+
The topic name could either be a canonical topic name within the current project, or the fully-qualified name referring to a topic in a different project using the `projects/<project_name>/topics/<topic_name>` format.
42
43
43
44
Here is an example of how to publish a message to a Google Cloud Pub/Sub topic:
`PubSubAdmin` is the abstraction provided by Spring Cloud GCP to manage Google Cloud Pub/Sub resources.
193
194
It allows for the creation, deletion and listing of topics and subscriptions.
194
195
196
+
NOTE: Generally when referring to topics, you can either use the short canonical topic name within the current project, or the fully-qualified name referring to a topic in a different project using the `projects/<project_name>/topics/<topic_name>` format.
197
+
195
198
`PubSubAdmin` depends on `GcpProjectIdProvider` and either a `CredentialsProvider` or a `TopicAdminClient` and a `SubscriptionAdminClient`.
196
199
If given a `CredentialsProvider`, it creates a `TopicAdminClient` and a `SubscriptionAdminClient` with the Google Cloud Java Library for Pub/Sub default settings.
197
200
The Spring Boot starter for GCP Pub/Sub auto-configures a `PubSubAdmin` object using the `GcpProjectIdProvider` and the `CredentialsProvider` auto-configured by the Spring Boot GCP Core starter.
Copy file name to clipboardexpand all lines: spring-cloud-gcp-pubsub/src/main/java/org/springframework/cloud/gcp/pubsub/support/DefaultPublisherFactory.java
0 commit comments