Browse Source

Return an error if the topic/partition is already consumed.

Willem van Bergen 10 years ago
parent
commit
29c4ebd656
1 changed files with 4 additions and 0 deletions
  1. 4 0
      mocks/consumer.go

+ 4 - 0
mocks/consumer.go

@@ -47,6 +47,10 @@ func (c *Consumer) ConsumePartition(topic string, partition int32, offset int64)
 	}
 
 	pc := c.partitionConsumers[topic][partition]
+	if pc.consumed {
+		return nil, sarama.ConfigurationError("The topic/partition is already being consumed")
+	}
+
 	pc.consumed = true
 	go pc.handleExpectations()
 	return pc, nil