messaging

package
v0.20.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ComponentName = "messaging"
)

Variables

View Source
var (
	ErrUnknownComponent = fmt.Errorf("component is not the %s component", ComponentName)
)

Functions

func New

func New() components.Component

func WithDispatcherDeliveryTimeout

func WithDispatcherDeliveryTimeout(deliveryTimeout time.Duration) components.Option

WithDispatcherDeliveryTimeout sets the maximum duration allowed for a batch of events to be delivered before timing out. This acts as a safeguard against workers hanging indefinitely.

func WithDispatcherEnabled

func WithDispatcherEnabled() components.Option

WithDispatcherEnabled enables the dispatcher loop. When set, the component will poll the outbox table and listen on the notify channel for new messages. Without this option, the dispatcher will not run.

func WithDispatcherMaxDeliveryRetries

func WithDispatcherMaxDeliveryRetries(maxDeliveryRetries int) components.Option

WithDispatcherMaxDeliveryRetries sets the maximum number of delivery attempts before an event is considered permanently failed and no longer retried.

func WithDispatcherMaxWorkers

func WithDispatcherMaxWorkers(maxWorkers int) components.Option

WithDispatcherMaxWorkers sets the maximum number of concurrent worker goroutines used by the dispatcher to process and deliver events in parallel.

func WithDispatcherPollInterval

func WithDispatcherPollInterval(pollInterval time.Duration) components.Option

WithDispatcherPollInterval sets how often the dispatcher polls the outbox table for new events when no notifications are received on the notify channel.

func WithOutboxIgnoreNoTx

func WithOutboxIgnoreNoTx(ignoreNoTx bool) components.Option

WithOutboxIgnoreNoTx configures whether inserting outbox events outside of an active transaction should be ignored instead of returning an error. By default, this is disabled (false).

func WithOutboxNotifyChannel

func WithOutboxNotifyChannel(notifyChannel string) components.Option

WithOutboxNotifyChannel sets the database NOTIFY channel used to signal listeners when new events are inserted into the outbox table. The same channel is also used by the dispatcher when enabled.

func WithOutboxSendNotify

func WithOutboxSendNotify(sendNotify bool) components.Option

WithOutboxSendNotify configures whether the outbox should send an explicit PostgreSQL NOTIFY after inserting a new event. By default, this is disabled (false).

func WithOutboxTable

func WithOutboxTable(tableName string) components.Option

WithOutboxTable sets the database table name used by the outbox to store and track pending events before they are dispatched.

Types

type Component

type Component struct {
	components.Base
	// contains filtered or unexported fields
}

func (*Component) Configure

func (c *Component) Configure(opts ...components.Option) error

func (*Component) Dispatcher

func (c *Component) Dispatcher() *dispatcher.Dispatcher

func (*Component) Outbox

func (c *Component) Outbox() *outbox.Outbox

func (*Component) Shutdown

func (c *Component) Shutdown() error

func (*Component) Start

func (c *Component) Start() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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