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

Function ExampleOpenTopic

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

Source from the content-addressed store, hash-verified

24)
25
26func ExampleOpenTopic() {
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 rabbitConn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
32 if err != nil {
33 log.Fatal(err)
34 }
35 defer rabbitConn.Close()
36 topic := rabbitpubsub.OpenTopic(rabbitConn, "myexchange", nil)
37 defer topic.Shutdown(ctx)
38}
39
40func ExampleOpenSubscription() {
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

OpenTopicFunction · 0.92
CloseMethod · 0.65
ShutdownMethod · 0.65
DialMethod · 0.45

Tested by

no test coverage detected