shared

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CycleTime = 100 * time.Millisecond

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"`
	Metadata  Metadata          `json:"metadata"`
	Tracing   Tracing           `json:"tracing"`
}

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 Metadata added in v1.10.0

type Metadata struct {
	Timestamp time.Time `json:"timestamp"`
}

type TraceValue

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

func GetSXTrace added in v0.0.4

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

type Tracing added in v1.10.0

type Tracing struct {
	OriginId      string `json:"originId"`
	DestinationId string `json:"destinationId"`
}

Jump to

Keyboard shortcuts

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