()
| 47 | } |
| 48 | |
| 49 | func Example_openSubscriptionFromURL() { |
| 50 | // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored. |
| 51 | // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/pubsub/mempubsub" |
| 52 | // PRAGMA: On gocloud.dev, hide lines until the next blank line. |
| 53 | ctx := context.Background() |
| 54 | |
| 55 | // Create a topic. |
| 56 | topic, err := pubsub.OpenTopic(ctx, "mem://topicA") |
| 57 | if err != nil { |
| 58 | log.Fatal(err) |
| 59 | } |
| 60 | defer topic.Shutdown(ctx) |
| 61 | |
| 62 | // Create a subscription connected to that topic. |
| 63 | subscription, err := pubsub.OpenSubscription(ctx, "mem://topicA") |
| 64 | if err != nil { |
| 65 | log.Fatal(err) |
| 66 | } |
| 67 | defer subscription.Shutdown(ctx) |
| 68 | } |
| 69 | |
| 70 | func Example_openTopicFromURL() { |
| 71 | // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored. |
nothing calls this directly
no test coverage detected