Add rocksmq client comments (#8475)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
This commit is contained in:
yukun 2021-09-24 16:05:55 +08:00 committed by GitHub
parent 865c67efdb
commit a8a0ae27ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -13,18 +13,24 @@ package rocksmq
import server "github.com/milvus-io/milvus/internal/util/rocksmq/server/rocksmq"
// SubscriptionInitialPosition is the initial subscription position
type SubscriptionInitialPosition int
// UniqueID is the type of message ID
type UniqueID = server.UniqueID
// List 2 kinds of SubscriptionInitialPosition
const (
SubscriptionPositionLatest SubscriptionInitialPosition = iota
SubscriptionPositionEarliest
)
// EarliestMessageID is used to get the earliest message ID, default -1
func EarliestMessageID() UniqueID {
return -1
}
// ConsumerOptions is the options of a consumer
type ConsumerOptions struct {
// The topic that this consumer will subscribe on
Topic string
@ -41,6 +47,7 @@ type ConsumerOptions struct {
MessageChannel chan ConsumerMessage
}
// ConsumerMessage is the message content of a consumer message
type ConsumerMessage struct {
Consumer
MsgID UniqueID
@ -48,6 +55,7 @@ type ConsumerMessage struct {
Payload []byte
}
// Consumer interface provide operations for a consumer
type Consumer interface {
// returns the subscription for the consumer
Subscription() string

View File

@ -11,14 +11,17 @@
package rocksmq
// ProducerOptions is the options of a producer
type ProducerOptions struct {
Topic string
}
// ProducerMessage is the message of a producer
type ProducerMessage struct {
Payload []byte
}
// Producer provedes some operations for a producer
type Producer interface {
// return the topic which producer is publishing to
Topic() string