message

package
v0.0.0-...-f414a8c Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerFunc

type HandlerFunc func(msg *Message) error

func HandleWithPayload

func HandleWithPayload[T any](handler HandlerFuncWithPayload[T]) HandlerFunc

type HandlerFuncWithPayload

type HandlerFuncWithPayload[T any] func(msg *Message, payload T) error

type Message

type Message struct {
	ID       string
	Metadata Metadata
	Payload  Payload
	// contains filtered or unexported fields
}

Message is the unit published and received. A received message is acknowledged from the result of the handler that processes it, see subscriber.Subscriber.

func NewMessage

func NewMessage(ctx context.Context, payload Payload) *Message

func (*Message) Context

func (m *Message) Context() context.Context

func (*Message) Copy

func (m *Message) Copy() *Message

Copy returns a shallow copy of the message, with its own metadata map.

func (*Message) Equals

func (m *Message) Equals(toCompare *Message) bool

Equals compare, that two messages are equal.

func (*Message) SetContext

func (m *Message) SetContext(ctx context.Context) *Message

func (*Message) WithMetadata

func (m *Message) WithMetadata(key string, value interface{}) *Message

type Metadata

type Metadata map[string]interface{}

type Payload

type Payload any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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