client

package
v0.0.0-...-6816f9f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 25 Imported by: 0

Documentation

Overview

Package client defines the api and information which can be exposed to user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmResult

type ConfirmResult struct {
	TopicName      string
	ConfirmContext string
	PeerInfo       *PeerInfo
}

ConfirmResult of a consumption.

type Consumer

type Consumer interface {
	// GetMessage receive a single message.
	GetMessage() (*ConsumerResult, error)
	// Confirm the consumption of a message.
	Confirm(confirmContext string, consumed bool) (*ConfirmResult, error)
	// GetCurrConsumedInfo returns the consumptions of the consumer.
	GetCurrConsumedInfo() map[string]*remote.ConsumerOffset
	// Close closes the consumer client and release the resources.
	Close()
	// GetClientID returns the clientID of the consumer.
	GetClientID() string
}

Consumer is an interface that abstracts behavior of TubeMQ's consumer

func NewConsumer

func NewConsumer(config *config.Config) (Consumer, error)

NewConsumer returns a consumer which is constructed by a given config.

type ConsumerResult

type ConsumerResult struct {
	TopicName      string
	ConfirmContext string
	PeerInfo       *PeerInfo
	Messages       []*Message
}

ConsumerResult of a consumption.

type Message

type Message struct {
	Topic      string
	Data       []byte
	DataLen    int32
	ID         int64
	Flag       int32
	Properties map[string]string
}

Message represents a TubeMQ message.

type PeerInfo

type PeerInfo struct {
	PartitionID  uint32
	BrokerHost   string
	PartitionKey string
	CurrOffset   int64
	MaxOffset    int64
}

PeerInfo represents the partition information of a broker.

type Producer

type Producer interface {
	Publish(topics []string)

	SendMessage(message *Message) (bool, int32, string)
}

func NewProducer

func NewProducer(config *config.Config) (Producer, error)

NewProducer returns a producer which is constructed by a given config.

type RoundRobinPartitionRouter

type RoundRobinPartitionRouter struct {
	// contains filtered or unexported fields
}

func NewPartitionRouter

func NewPartitionRouter() *RoundRobinPartitionRouter

func (*RoundRobinPartitionRouter) GetPartition

func (router *RoundRobinPartitionRouter) GetPartition(message *Message, partitionList []*metadata.Partition) int

Jump to

Keyboard shortcuts

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