middleware

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextFromMessageAttributes added in v0.2.0

func ContextFromMessageAttributes(tracer trace.Tracer, spanName string) func(next sqsprocessor.ProcessFunc) sqsprocessor.ProcessFunc

ContextFromMessageAttributes assumes the MessageAttributeValueCarrier was used alongside a propagation.TraceContext to inject a trace from the sender

func ContextFromMessageBody added in v0.2.3

func ContextFromMessageBody[T propagation.TextMapCarrier](tracer trace.Tracer, spanName string) func(next CustomProcessFunc[T]) CustomProcessFunc[T]

ContextFromMessageBody requires that the concrete message type implements the open telemetry propagation.TextMapCarrier interface, such as embedding the propagation.MapCarrier type: e.g.

type Message struct {
	AField string `json:"a_field"`
	propagation.MapCarrier `json:"trace"`
}

func JSONDecode

func JSONDecode[T any](processFunc CustomProcessFunc[T]) sqsprocessor.ProcessFunc

JSONDecode decodes the sqs message body into a given struct with json encoding

func RawMessage added in v0.2.0

func RawMessage(processFunc CustomProcessFunc[string]) sqsprocessor.ProcessFunc

RawMessage simply extracts the string value of an sqs message and passes it to a given CustomProcessFunc

func XMLDecode

func XMLDecode[T any](processFunc CustomProcessFunc[T]) sqsprocessor.ProcessFunc

XMLDecode decodes the sqs message into a given struct with xml encoding

Types

type CustomProcessFunc

type CustomProcessFunc[T any] func(context.Context, T) sqsprocessor.ProcessResult

CustomProcessFunc describes a sqsprocessor.ProcessFunc which operates on a concrete, generic type.

type Decoder added in v0.2.0

type Decoder[T any] func(processFunc CustomProcessFunc[T]) sqsprocessor.ProcessFunc

Decoder describes any function which transforms a sqsprocessor.ProcessFunc into a CustomProcessFunc operating on a given generic type, T

type MessageAttributeValueCarrier added in v0.2.0

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

MessageAttributeValueCarrier implements opentelemetry's propagation.TextMapCarrier interface for injecting and extracting traces into sqs messages

func NewMessageAttributeValueCarrier added in v0.2.0

func NewMessageAttributeValueCarrier(init map[string]types.MessageAttributeValue) *MessageAttributeValueCarrier

NewMessageAttributeValueCarrier returns a pointer to a new MessageAttributeCarrier and can be initalised with a map of string to types.MessageAttributeValue, provide nil if using for injection

func (*MessageAttributeValueCarrier) Get added in v0.2.0

func (*MessageAttributeValueCarrier) Keys added in v0.2.0

func (m *MessageAttributeValueCarrier) Keys() (keys []string)

func (*MessageAttributeValueCarrier) Set added in v0.2.0

func (m *MessageAttributeValueCarrier) Set(key string, value string)

Jump to

Keyboard shortcuts

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