OpenTopic returns a *pubsub.Topic backed by an existing GCP PubSub topic 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.Client, topicName string, opts *TopicOptions)
| 330 | // topicName is the last part of the full topic path, e.g., "foo" from "projects/<projectID>/topic/foo". |
| 331 | // See the package documentation for an example. |
| 332 | func OpenTopic(client *raw.Client, topicName string, opts *TopicOptions) *pubsub.Topic { |
| 333 | publisher := client.Publisher(topicName) |
| 334 | if opts == nil { |
| 335 | opts = &TopicOptions{} |
| 336 | } |
| 337 | bo := sendBatcherOpts.NewMergedOptions(&opts.BatcherOptions) |
| 338 | return pubsub.NewTopic(openTopic(publisher), bo) |
| 339 | } |
| 340 | |
| 341 | var topicPathRE = regexp.MustCompile("^projects/.+/topics/(.+)$") |
| 342 |