MCPcopy
hub / github.com/IBM/sarama / Topics

Method Topics

mocks/consumer.go:71–85  ·  view source on GitHub ↗

Topics returns a list of topics, as registered with SetTopicMetadata

()

Source from the content-addressed store, hash-verified

69
70// Topics returns a list of topics, as registered with SetTopicMetadata
71func (c *Consumer) Topics() ([]string, error) {
72 c.l.Lock()
73 defer c.l.Unlock()
74
75 if c.metadata == nil {
76 c.t.Errorf("Unexpected call to Topics. Initialize the mock's topic metadata with SetTopicMetadata.")
77 return nil, sarama.ErrOutOfBrokers
78 }
79
80 var result []string
81 for topic := range c.metadata {
82 result = append(result, topic)
83 }
84 return result, nil
85}
86
87// Partitions returns the list of parititons for the given topic, as registered with SetTopicMetadata
88func (c *Consumer) Partitions(topic string) ([]int32, error) {

Callers 2

Implementers 2

consumerconsumer.go
Consumermocks/consumer.go

Calls 1

ErrorfMethod · 0.65

Tested by 2