shared

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CycleTime = 100 * time.Millisecond

CycleTime is the default cycle time for loops. It is used in the consumer and producer.

Variables

This section is empty.

Functions

func AddSHeader added in v0.0.4

func AddSHeader(msg *KafkaMessage, key string, value string)

func AddSXOrigin added in v0.0.4

func AddSXOrigin(msg *KafkaMessage)

func AddSXTrace added in v0.0.4

func AddSXTrace(msg *KafkaMessage) error

func GetSHeader added in v0.0.4

func GetSHeader(msg *KafkaMessage, key string) (bool, string)

func GetSXOrigin added in v0.0.4

func GetSXOrigin(msg *KafkaMessage) (bool, string)

func IsInTrace added in v0.0.4

func IsInTrace(msg *KafkaMessage) bool

func IsSameOrigin added in v0.0.4

func IsSameOrigin(msg *KafkaMessage) bool

func ToConsumerMessage

func ToConsumerMessage(message *KafkaMessage) *sarama.ConsumerMessage

ToConsumerMessage converts a KafkaMessage to a sarama.ConsumerMessage.

func ToProducerMessage

func ToProducerMessage(message *KafkaMessage) *sarama.ProducerMessage

ToProducerMessage converts a KafkaMessage to a sarama.ProducerMessage. It ignores the Partition and Offset fields and sets trace headers.

Types

type KafkaMessage

type KafkaMessage struct {
	Headers   map[string]string `json:"headers"`
	Topic     string            `json:"topic"`
	Key       []byte            `json:"key"`
	Value     []byte            `json:"value"`
	Offset    int64             `json:"offset"`
	Partition int32             `json:"partition"`
}

KafkaMessage represents a message in the Kafka queue.

func FromConsumerMessage

func FromConsumerMessage(message *sarama.ConsumerMessage) *KafkaMessage

FromConsumerMessage converts a sarama.ConsumerMessage to a KafkaMessage.

type TraceValue

type TraceValue struct {
	Traces map[int64]string `json:"trace"`
}

func GetSXTrace added in v0.0.4

func GetSXTrace(msg *KafkaMessage) (bool, TraceValue)

Jump to

Keyboard shortcuts

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