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

View File

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