metadata

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CtxKafka represents the kafka context type
	CtxKafka = Key("kafka")
)

Variables

View Source
var (
	HeaderID              = "x-id"
	HeaderAction          = "x-action"
	HeaderStatusCode      = "x-status-code"
	HeaderVersion         = "x-version"
	HeaderParentID        = "x-parent-id"
	HeaderParentTimestamp = "x-parent-timestamp"
)

Kafka message headers

Functions

func MessageFromMessage

func MessageFromMessage(consumed *sarama.ConsumerMessage) *commander.Message

MessageFromMessage attempts to construct a commander message of the given sarama consumer message

func MessageToMessage

func MessageToMessage(produce *commander.Message) *sarama.ProducerMessage

MessageToMessage attempts to construct a sarama consumer message of the given commander message.

func NewKafkaContext

func NewKafkaContext(ctx context.Context, info Kafka) context.Context

NewKafkaContext creates a new context with Retries attached. If used NewKafkaContext will overwrite any previously-appended metadata.

Types

type Kafka

type Kafka struct {
	Offset    int64
	Partition int32
}

Kafka message metadata

func KafkaFromContext

func KafkaFromContext(ctx context.Context) (info Kafka, ok bool)

KafkaFromContext returns the Kafka in ctx if it exists. The returned Kafka should not be modified. Writing to it may cause races. Modification should be made to copies of the returned Kafka.

type Key

type Key string

Key typed context key

func (Key) String

func (k Key) String() string

Jump to

Keyboard shortcuts

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