| 61 | } |
| 62 | |
| 63 | func 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 | |
| 76 | func ExampleOpenSubscription() { |
| 77 | // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored. |