fanoutworker

package
v0.0.0-...-5a762db Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Worker)

Option is used to set worker creation options in New.

func OmittingAnalyticIDInOutDir

func OmittingAnalyticIDInOutDir() Option

OmittingAnalyticIDInOutDir causes the fanout worker to *not* add the analytic ID to output directories specified in input tasks.

type Worker

type Worker struct {
	*entroq.Worker
	// contains filtered or unexported fields
}

Worker is a worker that takes a task from one queue and creates multiple tasks in different output queues based on analytic IDs.

func New

func New(eqc *entroq.EntroQ, pgdb *sql.DB, inbox, outQFmt string, opts ...Option) *Worker

New creates a new runnable fanout worker, given an EntroQ client, a PostgreSQL database, an inbox name, and an output task queue format string with a single "%s" specifier. The analytic ID in a request will be inserted in that point in the format string, after applying url.PathEscape to it.

func (*Worker) AnalyticInbox

func (w *Worker) AnalyticInbox(id string) string

AnalyticInbox returns the inbox name for a given analytic ID.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Run runs the fanout worker until it is stopped or the context is canceled or a permanent error occurs.

Jump to

Keyboard shortcuts

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