tasks

package
v0.0.0-...-a4f4c6b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTask

func RegisterTask(name string, function any)

func StartServer

func StartServer(tasksConfig Config) (server *machinery.Server, err error)

Types

type Broker

type Broker struct {
	CleanupMachinery func()
	CleanupSpan      func()
	BatchID          string
	Server           *machinery.Server
	Ctx              context.Context
}

func NewBroker

func NewBroker(config Config) (broker *Broker, err error)

func (*Broker) Cleanup

func (b *Broker) Cleanup()

Cleanup cleans up the machinery server and the span that were created for this Broker.

func (*Broker) SendChainWithContext

func (b *Broker) SendChainWithContext(chain *tasks.Chain) (*result.ChainAsyncResult, error)

SendChainWithContext acts as a wrapper for machinery.Server.SendChainWithContext

func (*Broker) SendChordWithContext

func (b *Broker) SendChordWithContext(chord *tasks.Chord, sendConcurrency int) (*result.ChordAsyncResult, error)

SendChordWithContext acts as a wrapper for machinery.Server.SendChordWithContext

func (*Broker) SendGroupWithContext

func (b *Broker) SendGroupWithContext(group *tasks.Group, sendConcurrency int) ([]*result.AsyncResult, error)

SendGroupWithContext acts as a wrapper for machinery.Server.SendGroupWithContext

func (*Broker) SendTaskWithContext

func (b *Broker) SendTaskWithContext(signature *tasks.Signature) (*result.AsyncResult, error)

SendTaskWithContext acts as a wrapper for machinery.Server.SendTaskWithContext.

type Config

type Config interface {
	TasksDefaultQueue() string
	TasksResultsExpireIn() int
	TasksBroker() string
	TasksResultBackend() string
	TasksRedis() RedisConfig
	TasksPeriodicTaskSignatures() map[string]PeriodicTaskSignature
	TasksPeriodicTaskSignature(taskName string) PeriodicTaskSignature
}

type PeriodicTaskSignature

type PeriodicTaskSignature interface {
	PeriodicTaskSignatureArgs() []tasks.Arg
	PeriodicTaskSignatureCron() string
	PeriodicTaskSignatureRetryCount() int
}

type RedisConfig

type RedisConfig interface {
	RedisMaxIdle() int
	RedisIdleTimeout() int
	RedisReadTimeout() int
	RedisWriteTimeout() int
	RedisConnectTimeout() int
	RedisNormalTasksPollPeriod() int
	RedisDelayedTasksPollPeriod() int
}

Jump to

Keyboard shortcuts

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