MCPcopy Create free account
hub / github.com/google/go-cloud / OpenTopic

Function OpenTopic

pubsub/gcppubsubv2/gcppubsub.go:332–339  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
332func 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
341var topicPathRE = regexp.MustCompile("^projects/.+/topics/(.+)$")
342

Callers 4

ExampleOpenTopicFunction · 0.92
TestOpenTopicFunction · 0.70
OpenTopicURLMethod · 0.70
OpenTopicByPathFunction · 0.70

Calls 2

NewMergedOptionsMethod · 0.80
openTopicFunction · 0.70

Tested by 2

ExampleOpenTopicFunction · 0.74
TestOpenTopicFunction · 0.56