()
| 29 | ) |
| 30 | |
| 31 | func Example() { |
| 32 | // The task starter is used for automatic re-subscription on failure. |
| 33 | taskStarter := task.StartTaskFunc(task.DefaultStartTask) |
| 34 | |
| 35 | // Import the desired cloud pub-sub drivers (see godoc.org/gocloud.dev). |
| 36 | // In this example we use "gocloud.dev/pubsub/mempubsub". |
| 37 | |
| 38 | cloudPubSub, err := cloud.NewPubSub(context.TODO(), taskStarter, "mem://events", "mem://events") |
| 39 | if err != nil { |
| 40 | panic(err) |
| 41 | } |
| 42 | |
| 43 | // Replace the default pubsub so that we will now publish to a Go Cloud pub sub. |
| 44 | events.SetDefaultPubSub(cloudPubSub) |
| 45 | } |
| 46 | |
| 47 | var timeout = (1 << 10) * test.Delay |
| 48 |
nothing calls this directly
no test coverage detected