mqwrapper

package
v0.0.0-...-572c485 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPartitionIdx = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// CreateProducer creates a producer instance
	CreateProducer(options common.ProducerOptions) (Producer, error)

	// Subscribe creates a consumer instance and subscribe a topic
	Subscribe(options ConsumerOptions) (Consumer, error)

	// Get the earliest MessageID
	EarliestMessageID() common.MessageID

	// String to msg ID
	StringToMsgID(string) (common.MessageID, error)

	// Deserialize MessageId from a byte array
	BytesToMsgID([]byte) (common.MessageID, error)

	// Close the client and free associated resources
	Close()
}

Client is the interface that provides operations of message queues

type Consumer

type Consumer interface {
	// returns the subscription for the consumer
	Subscription() string

	// Get Message channel, once you chan you can not seek again
	Chan() <-chan common.Message

	// Seek to the uniqueID position, the second bool param indicates whether the message is included in the position
	Seek(common.MessageID, bool) error //nolint:govet

	// Ack make sure that msg is received
	Ack(common.Message)

	// Close consumer
	Close()

	// GetLatestMsgID return the latest message ID
	GetLatestMsgID() (common.MessageID, error)

	// check created topic whether vaild or not
	CheckTopicValid(channel string) error
}

Consumer is the interface that provides operations of a consumer

type ConsumerOptions

type ConsumerOptions struct {
	// The topic that this consumer will subscribe on
	Topic string

	// The subscription name for this consumer
	SubscriptionName string

	// InitialPosition at which the cursor will be set when subscribe
	// Default is `Latest`
	common.SubscriptionInitialPosition

	// Set receive channel size
	BufSize int64
}

ConsumerOptions contains the options of a consumer

type Producer

type Producer interface {

	// publish a message
	Send(ctx context.Context, message *common.ProducerMessage) (common.MessageID, error)

	Close()
}

Producer is the interface that provides operations of producer

type UniqueID

type UniqueID = int64

UniqueID is the type of message id

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL