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

Method CreateTopic

pubsub/rabbitpubsub/rabbit_test.go:116–129  ·  view source on GitHub ↗
(_ context.Context, testName string)

Source from the content-addressed store, hash-verified

114}
115
116func (h *harness) CreateTopic(_ context.Context, testName string) (dt driver.Topic, cleanup func(), err error) {
117 exchange := fmt.Sprintf("%s-topic-%d", testName, atomic.AddUint32(&h.numTopics, 1))
118 if err := declareExchange(h.conn, exchange); err != nil {
119 return nil, nil, err
120 }
121 cleanup = func() {
122 ch, err := h.conn.Channel()
123 if err != nil {
124 panic(err)
125 }
126 ch.ExchangeDelete(exchange)
127 }
128 return newTopic(h.conn, exchange, nil), cleanup, nil
129}
130
131func (h *harness) MakeNonexistentTopic(context.Context) (driver.Topic, error) {
132 return newTopic(h.conn, "nonexistent-topic", nil), nil

Callers 3

BenchmarkRabbitFunction · 0.95
TestOpenTopicFromURLFunction · 0.95

Calls 4

declareExchangeFunction · 0.85
newTopicFunction · 0.70
ChannelMethod · 0.65
ExchangeDeleteMethod · 0.65

Tested by

no test coverage detected