messaging

package
v0.2.25 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package messaging implements messaging patterns like publish-subscribe to decouple local and remote services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	Publish(ctx context.Context, message Message) error
	Subscribe(ctx context.Context, topic string, fn service.Function[Message, MessageState]) error
}

Dispatcher is an interface for a message dispatcher.

func NewExternalDispatcher added in v0.1.82

func NewExternalDispatcher() Dispatcher

NewExternalDispatcher creates a new externalDispatcher instance.

func NewInternalDispatcher added in v0.1.79

func NewInternalDispatcher() Dispatcher

NewInternalDispatcher creates a new internalDispatcher instance.

type Message

type Message struct {
	Data  []byte       `json:"data"`
	State MessageState `json:"state"`
	Topic string       `json:"topic"`
}

Message is a struct that represents a message.

func NewMessage

func NewMessage(topic string, data []byte) Message

NewMessage creates a new message.

type MessageState added in v0.1.79

type MessageState int

MessageState is an enum that represents the state of a message.

const (
	MessageStateCreated MessageState = iota
	MessageStateCompleted
	MessageStateFailed
)

Jump to

Keyboard shortcuts

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