utils

package
v0.0.0-...-dc14e26 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateMsgLength

func CalculateMsgLength(message pulsar.Message) int

func ConvertMap2Headers

func ConvertMap2Headers(m map[string]string) []*codec.Header

func DebugKafkaTopicMatch

func DebugKafkaTopicMatch(s set.Set[string], topic string) bool

func DebugPulsarPartitionTopicMatch

func DebugPulsarPartitionTopicMatch(s set.Set[string], partitionTopic string) bool

func DebugTopicMatch

func DebugTopicMatch(kSet, pSet set.Set[string], kTopic, pTopic string) bool

func GetLatestMsgId

func GetLatestMsgId(partitionedTopic string, client *padmin.PulsarAdmin) (*padmin.MessageId, error)

func PartitionedTopic

func PartitionedTopic(topic string, partition int) string

func ReadEarliestMsg

func ReadEarliestMsg(partitionedTopic string, maxWaitMs int, pulsarClient pulsar.Client) (pulsar.Message, error)

func ReadLatestMsg

func ReadLatestMsg(partitionedTopic string, maxWaitMs int, messageId *padmin.MessageId, pulsarClient pulsar.Client) (pulsar.Message, error)

Types

type KeyBasedRateLimiter

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

func NewKeyBasedRateLimiter

func NewKeyBasedRateLimiter(seconds, times int) *KeyBasedRateLimiter

func (*KeyBasedRateLimiter) Acquire

func (k *KeyBasedRateLimiter) Acquire(key string) bool

func (*KeyBasedRateLimiter) Clean

func (k *KeyBasedRateLimiter) Clean(key string)

type PartitionedTopicInfo

type PartitionedTopicInfo struct {
	Tenant    string
	Namespace string
	Topic     string
	Partition int
}

func GetTenantNamespaceTopicFromPartitionedPrefix

func GetTenantNamespaceTopicFromPartitionedPrefix(str string) (info PartitionedTopicInfo, err error)

Jump to

Keyboard shortcuts

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