notifier

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotificationTopicLongest = func() NotificationTopic {
	return slices.MaxFunc(notificationTopicAll, func(t1, t2 NotificationTopic) int {
		return len(string(t1)) - len(string(t2))
	})
}()

NotificationTopicLongest is just the longest notification topic. This is used to determine the maximum length of allowed custom schema names because schemas are prefixed to notification topic names and Postgres enforces a maximum topic length of 63 characters.

Functions

This section is empty.

Types

type NotificationTopic

type NotificationTopic string
const (
	NotificationTopicControl    NotificationTopic = "river_control"
	NotificationTopicInsert     NotificationTopic = "river_insert"
	NotificationTopicLeadership NotificationTopic = "river_leadership"
)

type Notifier

type Notifier struct {
	baseservice.BaseService
	startstop.BaseStartStop
	// contains filtered or unexported fields
}

func New

func New(archetype *baseservice.Archetype, listener riverdriver.Listener) *Notifier

func (*Notifier) Listen

func (n *Notifier) Listen(ctx context.Context, topic NotificationTopic, notifyFunc NotifyFunc) (*Subscription, error)

func (*Notifier) Start added in v0.1.0

func (n *Notifier) Start(ctx context.Context) error

type NotifyFunc

type NotifyFunc func(topic NotificationTopic, payload string)

type Subscription

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

func (*Subscription) Unlisten

func (s *Subscription) Unlisten(ctx context.Context)

Jump to

Keyboard shortcuts

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