worker

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, eng *engine.Engine, queue JobQueue, queues []string)

Fungsi Utama Worker (Berjalan di Background)

Types

type DBQueue

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

func NewDBQueue

func NewDBQueue(dbMgr *dbmanager.DBManager, connName string) *DBQueue

func (*DBQueue) Close

func (q *DBQueue) Close() error

func (*DBQueue) Pop

func (q *DBQueue) Pop(ctx context.Context, queues []string) (string, []byte, error)

func (*DBQueue) Push

func (q *DBQueue) Push(ctx context.Context, queue string, payload []byte) error

type JobPayload

type JobPayload struct {
	ScriptPath string                 `json:"script_path"`
	Data       map[string]interface{} `json:"data"`
	CreatedAt  time.Time              `json:"created_at"`
}

Struktur Data Tugas

type JobQueue

type JobQueue interface {
	// Push adds a job to the queue
	Push(ctx context.Context, queue string, payload []byte) error

	// Pop retrieves a job from one of the specified queues (blocking or polling)
	// Returns queue name, payload, and error
	Pop(ctx context.Context, queues []string) (string, []byte, error)

	// Close cleans up resources
	Close() error
}

JobQueue defines the interface for a background job queue

Jump to

Keyboard shortcuts

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