events

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricEnqueuedTotal = "enqueued_total"
	MetricSentTotal     = "sent_total"
	MetricFailedTotal   = "failed_total"

	LabelEvent        = "event"
	LabelDeliveryType = "delivery_type"
	LabelReason       = "reason"

	DeliveryTypePush    = "push"
	DeliveryTypeSSE     = "sse"
	DeliveryTypeUnknown = "unknown"

	FailureReasonQueueFull      = "queue_full"
	FailureReasonProviderFailed = "provider_failed"
)

Metric constants

Variables

View Source
var Module = fx.Module(
	"events",
	fx.Decorate(func(log *zap.Logger) *zap.Logger {
		return log.Named("events")
	}),
	fx.Provide(newMetrics, fx.Private),
	fx.Provide(NewService),
	fx.Invoke(func(lc fx.Lifecycle, svc *Service) {
		ctx, cancel := context.WithCancel(context.Background())
		lc.Append(fx.Hook{
			OnStart: func(_ context.Context) error {
				go svc.Run(ctx)
				return nil
			},
			OnStop: func(_ context.Context) error {
				cancel()
				return nil
			},
		})
	}),
)

Functions

This section is empty.

Types

type Event

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

func NewEvent

func NewEvent(eventType smsgateway.PushEventType, data map[string]string) *Event

func NewMessageEnqueuedEvent

func NewMessageEnqueuedEvent() *Event

func NewMessagesExportRequestedEvent

func NewMessagesExportRequestedEvent(since, until time.Time) *Event

func NewSettingsUpdatedEvent

func NewSettingsUpdatedEvent() *Event

func NewWebhooksUpdatedEvent

func NewWebhooksUpdatedEvent() *Event

type Service

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

func NewService

func NewService(devicesSvc *devices.Service, sseSvc *sse.Service, pushSvc *push.Service, metrics *metrics, logger *zap.Logger) *Service

func (*Service) Notify

func (s *Service) Notify(userID string, deviceID *string, event *Event) error

func (*Service) Run

func (s *Service) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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