message

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomID

func GenerateRandomID() ([]byte, error)

Types

type JsonMessage

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

func (*JsonMessage) Data

func (m *JsonMessage) Data() []byte

func (*JsonMessage) ID

func (m *JsonMessage) ID() []byte

func (*JsonMessage) Metadata

func (m *JsonMessage) Metadata() map[string]interface{}

func (*JsonMessage) Pack

func (m *JsonMessage) Pack() ([]byte, error)

func (*JsonMessage) SetData

func (m *JsonMessage) SetData(data []byte) error

func (*JsonMessage) SetID

func (m *JsonMessage) SetID(id []byte) error

func (*JsonMessage) SetMetadata

func (m *JsonMessage) SetMetadata(metadata map[string]interface{}) error

func (*JsonMessage) String

func (m *JsonMessage) String() string

func (*JsonMessage) Unpack

func (m *JsonMessage) Unpack(b []byte) error

type Message

type Message interface {
	ID() []byte
	SetID(id []byte) error

	// Used for recording extra data, e.g, retry count
	Metadata() map[string]interface{}
	SetMetadata(metadata map[string]interface{}) error

	Data() []byte
	SetData(data []byte) error

	// Converts the message into a binary package
	Pack() ([]byte, error)

	// Converts a binary package into the message
	Unpack([]byte) error

	String() string
}

Message represents a message that can be sent to a queue, network, etc NOTE: It's not thread-safe

type MessageIDGenerator

type MessageIDGenerator func() ([]byte, error)

func GenerateSequencialIDFunc

func GenerateSequencialIDFunc() MessageIDGenerator

Jump to

Keyboard shortcuts

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