eventqueue

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package eventqueue polls the event queues of connections whose events come through a queue ReputeCast reads instead of a webhook (review PR-4: SES → SNS → an SQS queue). Nothing has to reach ReputeCast from the internet, so it works behind NAT and firewalls.

Each message is stored as a raw event, like a webhook delivery, and normalized later by the ingest job; it leaves the queue only once it is stored, so a crash or a restart loses nothing (the queue redelivers it).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PollArgs

type PollArgs struct{}

PollArgs polls every event queue once (about a minute of long polls).

func (PollArgs) InsertOpts

func (PollArgs) InsertOpts() river.InsertOpts

InsertOpts implements river.JobArgsWithInsertOpts.

func (PollArgs) Kind

func (PollArgs) Kind() string

Kind implements river.JobArgs.

type Worker

type Worker struct {
	river.WorkerDefaults[PollArgs]
	Pool    *pgxpool.Pool
	Q       *store.Queries
	Factory *manage.Factory
	Jobs    func() *jobs.Client
	Log     *slog.Logger
	Now     func() time.Time
	// OnPoll is told how each poll of a queue went, so a queue that can't
	// be read reaches the provider's health.
	OnPoll func(ctx context.Context, p store.Provider, err error)
	// For overrides how long a job polls each queue (tests).
	For time.Duration
}

Worker polls the queues.

func (*Worker) Poll

func (w *Worker) Poll(ctx context.Context, p store.Provider) (n int, err error)

Poll reads a provider's queue for up to a minute: each message is stored as a raw event and queued for normalization, then removed from the queue.

func (*Worker) Timeout

func (w *Worker) Timeout(*river.Job[PollArgs]) time.Duration

Timeout bounds one job.

func (*Worker) Work

func (w *Worker) Work(ctx context.Context, _ *river.Job[PollArgs]) error

Work implements river.Worker.

Jump to

Keyboard shortcuts

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