MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Example

Function Example

pkg/events/cloud/cloud_test.go:31–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29)
30
31func 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
47var timeout = (1 << 10) * test.Delay
48

Callers

nothing calls this directly

Calls 3

StartTaskFuncFuncType · 0.92
NewPubSubFunction · 0.92
SetDefaultPubSubFunction · 0.92

Tested by

no test coverage detected