Skip to content
Snippets Groups Projects
Select Git revision
  • 2b5da00395893808fb10eb3cfc938a5dabe2813e
  • master default protected
  • 1.31
  • 4.38.2
  • 4.38.1
  • 4.38.0
  • 4.37.2
  • 4.37.1
  • 4.37.0
  • 4.36.0
  • 4.35.0
  • 4.34.1
  • 4.34.0
  • 4.33.1
  • 4.33.0
  • 4.32.2
  • 4.32.1
  • 4.32.0
  • 4.31.0
  • 4.30.1
  • 4.30.0
  • 4.29.1
  • 4.29.0
23 results

chglog

  • Clone with SSH
  • Clone with HTTPS
  • Job Queues

    Overview

    These jobQueue library written in Go provides a simple interface for managing jobs and workers. It is designed to be used in a distributed environment where multiple workers can be assigned to a job queue. The library provides a Manager that can be used to manage workers, schedule jobs, and handle the state of the job queue.

    Jobs can also be persisted to a database using Gorm.

    The library also provides a Cron instance for scheduling jobs.

    Getting Started

    Prerequisites

    • Go 1.22+

    Installation

    go get -u gitlab.schukai.com/oss/libraries/go/services/job-queues

    Usage

    Import the package and create a new queue.

    import "gitlab.schukai.com/oss/libraries/go/services/job-queues"
    
    
    func main() {
    var err error
    
    m := jobqueue.NewManager()
    w := jobqueue.NewWorker("worker1")
    _ = m.AddWorker(w)
    
    _ = m.Start()
    
    job := jobqueue.Job{
    ID: "job1",
    }
    scheduler := jobqueue.InstantScheduler{}
    
    _ = m.ScheduleJob(job, &scheduler)
    
    }
    

    Development

    Command Description
    task check-code Run linters and static code analysis
    task run-tests Run tests

    License

    This project is licensed under the AGPL-3.0 License - see the LICENSE.md file for details.

    Contact