Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarkWorkerSkipped ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps River so callers can enqueue jobs on the shared Postgres runtime without depending on driver-specific setup details.
func NewEnqueueOnly ¶
NewEnqueueOnly creates a queue client that can enqueue River jobs inside SQL transactions, but does not start any River workers to execute jobs.
func NewWorkerHost ¶
func NewWorkerHost(pool *pgxpool.Pool, config *WorkerHostConfig) (*Client, error)
NewWorkerHost creates a River client that can work jobs when registrars are provided, and otherwise falls back to enqueue-only behavior without running any River workers.
func (*Client) CancelJob ¶
CancelJob uses River's transactional state machine and running-job notification. A running job receives cancellation intent, not a claim that it has stopped.
func (*Client) WorkerLivenessSnapshot ¶
func (c *Client) WorkerLivenessSnapshot(now time.Time) []WorkerLivenessMetric
WorkerLivenessSnapshot reports configured worker queue liveness without exposing job payloads.
type Config ¶
type Config struct {
Queues map[string]river.QueueConfig
PeriodicJobs []*river.PeriodicJob
Workers *river.Workers
Logger *slog.Logger
RetryPolicy river.ClientRetryPolicy
}
Config configures the internal River-backed queue client.
type EnqueueRequest ¶
type EnqueueRequest struct {
Args JobArgs
Queue string
// InitiatingAccount serializes account-bound admission with account removal.
// Leave empty for organization/system work that must survive its initiator.
InitiatingAccount slug.Slug
}
EnqueueRequest describes a job that should become visible when tx commits.
type Enqueuer ¶
type Enqueuer interface {
EnqueueTx(ctx context.Context, tx postgres.DBTX, req EnqueueRequest) (QueuedJob, error)
}
Enqueuer is the service-facing port for durable background work.
func NewEnqueuer ¶
type JobArgs ¶
type JobArgs interface {
Kind() string
InsertOpts() river.InsertOpts
}
JobArgs identifies a durable River job payload and its enqueue options.
type WorkerHostConfig ¶
type WorkerHostConfig struct {
Queues map[string]river.QueueConfig
PeriodicJobs []*river.PeriodicJob
Registrars []WorkerRegistrar
Logger *slog.Logger
RetryPolicy river.ClientRetryPolicy
}
WorkerHostConfig configures a worker-capable River client.
type WorkerLivenessMetric ¶
type WorkerLivenessMetric struct {
Queue string
ActiveWorkers int64
MaxWorkers int64
LastHeartbeatAge time.Duration
}
WorkerLivenessMetric describes queue-worker liveness for metrics collection.
type WorkerRegistrar ¶
WorkerRegistrar registers one or more River workers on a shared bundle.