confmq

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Carry

func Carry(ps PubSub) contextx.Carrier

func MarshalV

func MarshalV(v any) ([]byte, error)

func UnmarshalV

func UnmarshalV(data []byte, v any) error

func With

func With(ctx context.Context, ps PubSub) context.Context

Types

type Message

type Message interface {
	Topic() string
	ID() int64
	Timestamp() time.Time

	Data() []byte
	Extra() map[string][]string
}

func NewMessage

func NewMessage(ctx context.Context, topic string, v any) Message

func NewMessageFromRaw

func NewMessageFromRaw(ctx context.Context, topic string, raw []byte) Message

func ParseMessage

func ParseMessage(data []byte) (Message, error)

ParseMessage data from message queue consumer

type MessageArshaler

type MessageArshaler interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

type MutMessage

type MutMessage interface {
	Message

	AddExtra(string, string)
}

type Option added in v0.2.6

type Option interface {
	OptionScheme() string
}

type OptionApplier added in v0.2.6

type OptionApplier interface {
	Apply(Option)
}

type OptionApplyFunc added in v0.2.6

type OptionApplyFunc func(Option)

func (OptionApplyFunc) Apply added in v0.2.6

func (f OptionApplyFunc) Apply(opt Option)

type PubSub

type PubSub interface {
	// Publisher returns a publisher
	Publisher(ctx context.Context, options ...OptionApplier) (Publisher, error)
	// Subscriber returns a subscriber
	Subscriber(ctx context.Context, options ...OptionApplier) (Subscriber, error)
	// Close closes pub/sub endpoint
	Close() error
}

func From

func From(ctx context.Context) (PubSub, bool)

func Must

func Must(ctx context.Context) PubSub

type Publisher added in v0.2.10

type Publisher interface {
	Topic() string
	Publish(context.Context, any) error
	PublishMessage(context.Context, Message) error
	Close()
}

type Subscriber

type Subscriber interface {
	// Run starts consuming and handling messages with h
	Run(ctx context.Context, h func(context.Context, Message) error) <-chan error
	// Close closes this subscriber
	Close()
}

Jump to

Keyboard shortcuts

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