worker

package
v0.0.0-...-b2c82e1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackSender

type CallbackSender interface {
	SendCallback(appID string, payload webhook.WebhookPayload) error
}

type CallbackTask

type CallbackTask struct {
	AppID          string                 `json:"app_id"`
	WebhookPayload webhook.WebhookPayload `json:"webhook"`
}

CallbackTask is the task to be queued.

func (*CallbackTask) Send

func (ct *CallbackTask) Send(s CallbackSender) error

Send executes the send operation, so a webhook is sent to the configured callback url.

type CallbackWorker

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

Worker represents a single worker

func NewCallbackWorker

func NewCallbackWorker(id int, queue QueueManager, logger log.Logger, callbackSender CallbackSender) CallbackWorker

NewCallbackWorker creates a new worker

func (CallbackWorker) Start

func (w CallbackWorker) Start(wg *sync.WaitGroup)

Start begins the worker's task processing loop

func (CallbackWorker) Stop

func (w CallbackWorker) Stop()

Stop signals the worker to stop

type CallbackWorkerPool

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

CallbackWorkerPool manages the task queue and worker pool

func NewCallbackWorkerPool

func NewCallbackWorkerPool(queue QueueManager, logger log.Logger, callbackSender CallbackSender, numWorkers int) *CallbackWorkerPool

NewCallbackWorkerPool creates a new worker pool

func (*CallbackWorkerPool) Send

func (wp *CallbackWorkerPool) Send(qm CallbackTask) error

Send adds a task to the task queue

func (*CallbackWorkerPool) Start

func (wp *CallbackWorkerPool) Start()

Start initializes and starts the workers

func (*CallbackWorkerPool) Stop

func (wp *CallbackWorkerPool) Stop()

Stop signals all workers to stop

type QueueManager

type QueueManager interface {
	Receive(context.Context) (*goqite.Message, error)
	Delete(ctx context.Context, id goqite.ID) error
	Extend(ctx context.Context, id goqite.ID, delay time.Duration) error
	Send(ctx context.Context, m goqite.Message) error
}

Jump to

Keyboard shortcuts

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