Skip to content
Snippets Groups Projects
Select Git revision
  • 56b5accef9dcb6db9ad4ee30694c08b239c8c058
  • master default protected
  • 1.31
  • 4.38.8
  • 4.38.7
  • 4.38.6
  • 4.38.5
  • 4.38.4
  • 4.38.3
  • 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
23 results

flake.lock

Blame
  • 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)
        
    }
    

    Tests

    Run tests using:

    task test

    License

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

    Contact