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 ¶
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 )
Click to show internal directories.
Click to hide internal directories.