未验证 提交 2b3762fa 编写于 作者: S shaoyue 提交者: GitHub

[skip ci] Add comments for pulsar_consumer.go (#12446)

Signed-off-by: Nshaoyue.chen <shaoyue.chen@zilliz.com>
上级 5bffbba2
......@@ -19,6 +19,7 @@ import (
"github.com/milvus-io/milvus/internal/log"
)
// PulsarConsumer consumes from pulsar
type PulsarConsumer struct {
c pulsar.Consumer
pulsar.Reader
......@@ -30,10 +31,12 @@ type PulsarConsumer struct {
skip bool
}
// Subscription get a subscription for the consumer
func (pc *PulsarConsumer) Subscription() string {
return pc.c.Subscription()
}
// Chan returns a message channel
func (pc *PulsarConsumer) Chan() <-chan Message {
if pc.msgChannel == nil {
pc.once.Do(func() {
......@@ -88,11 +91,13 @@ func (pc *PulsarConsumer) Seek(id MessageID, inclusive bool) error {
return err
}
// Ack the consumption of a single message
func (pc *PulsarConsumer) Ack(message Message) {
pm := message.(*pulsarMessage)
pc.c.Ack(pm.msg)
}
// Close the consumer and stop the broker to push more messages
func (pc *PulsarConsumer) Close() {
pc.c.Close()
close(pc.closeCh)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册