labuladong commented on code in PR #904:
URL: https://github.com/apache/pulsar-client-go/pull/904#discussion_r1044943706
##########
pulsar/consumer_test.go:
##########
@@ -384,6 +385,138 @@ func TestPartitionTopicsConsumerPubSub(t *testing.T) {
assert.Equal(t, len(msgs), 10)
}
+type TestActiveConsumerListener struct {
+ lock sync.RWMutex
+ nameToPartitions map[string]map[int32]struct{}
+}
+
+func (t *TestActiveConsumerListener) getConsumerCount() int {
+ t.lock.RLock()
+ defer t.lock.RUnlock()
+ return len(t.nameToPartitions)
+}
+
+func (t *TestActiveConsumerListener) getPartitionCount(consumerName string)
int {
+ t.lock.RLock()
+ defer t.lock.RUnlock()
+ return len(t.nameToPartitions[consumerName])
+}
+
+func (t *TestActiveConsumerListener) BecameActive(consumer Consumer, topicName
string, partition int32) {
+ fmt.Printf("%s become active on %s - %d\n", consumer.Name(), topicName,
partition)
Review Comment:
Oh, I can pass `testing.T` to the callback to use it 😂 Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]