OpenTopic returns a *pubsub.Topic backed by an existing GCP PubSub topic in the given projectID. topicName is the last part of the full topic path, e.g., "foo" from "projects/ /topic/foo". See the package documentation for an example.
(client *raw.PublisherClient, projectID gcp.ProjectID, topicName string, opts *TopicOptions)
| 338 | // path, e.g., "foo" from "projects/<projectID>/topic/foo". |
| 339 | // See the package documentation for an example. |
| 340 | func OpenTopic(client *raw.PublisherClient, projectID gcp.ProjectID, topicName string, opts *TopicOptions) *pubsub.Topic { |
| 341 | topicPath := fmt.Sprintf("projects/%s/topics/%s", projectID, topicName) |
| 342 | if opts == nil { |
| 343 | opts = &TopicOptions{} |
| 344 | } |
| 345 | bo := sendBatcherOpts.NewMergedOptions(&opts.BatcherOptions) |
| 346 | return pubsub.NewTopic(openTopic(client, topicPath), bo) |
| 347 | } |
| 348 | |
| 349 | var topicPathRE = regexp.MustCompile("^projects/.+/topics/.+$") |
| 350 |