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

Function ExampleOpenSubscription

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

Source from the content-addressed store, hash-verified

38}
39
40func ExampleOpenSubscription() {
41 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
42 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
43 ctx := context.Background()
44
45 rabbitConn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
46 if err != nil {
47 log.Fatal(err)
48 }
49 defer rabbitConn.Close()
50 subscription := rabbitpubsub.OpenSubscription(rabbitConn, "myqueue", nil)
51 defer subscription.Shutdown(ctx)
52}
53
54func Example_openTopicFromURL() {
55 // 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

OpenSubscriptionFunction · 0.92
CloseMethod · 0.65
ShutdownMethod · 0.65
DialMethod · 0.45

Tested by

no test coverage detected