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

Function ExampleNewSubscription

pubsub/mempubsub/example_test.go:26–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24)
25
26func ExampleNewSubscription() {
27 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
28 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
29 ctx := context.Background()
30
31 // Construct a *pubsub.Topic.
32 topic := mempubsub.NewTopic()
33 defer topic.Shutdown(ctx)
34
35 // Construct a *pubsub.Subscription for the topic.
36 subscription := mempubsub.NewSubscription(topic, 1*time.Minute /* ack deadline */)
37 defer subscription.Shutdown(ctx)
38}
39
40func ExampleNewTopic() {
41 // 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 4

ShutdownMethod · 0.95
ShutdownMethod · 0.95
NewTopicFunction · 0.92
NewSubscriptionFunction · 0.92

Tested by

no test coverage detected