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

Function Example_openTopicFromURL

pubsub/gcppubsub/example_test.go:63–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63func Example_openTopicFromURL() {
64 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
65 // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/pubsub/gcppubsub"
66 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
67 ctx := context.Background()
68
69 topic, err := pubsub.OpenTopic(ctx, "gcppubsub://projects/myproject/topics/mytopic")
70 if err != nil {
71 log.Fatal(err)
72 }
73 defer topic.Shutdown(ctx)
74}
75
76func ExampleOpenSubscription() {
77 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.

Callers

nothing calls this directly

Calls 2

OpenTopicFunction · 0.92
ShutdownMethod · 0.65

Tested by

no test coverage detected