# 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

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

## Usage

Import the package and create a new queue.

```go
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 library is available under the [AGPL-3.0](https://choosealicense.com/licenses/agpl-3.0/) 
license for open-source projects. For commercial use, please reach out to us 
at [sales@schukai.com](mailto:sales@schukai.com).

## Contact

- schukai GmbH - [schukai.de](https://www.schukai.com)
- [info@schukai.com](mailto:info@schukai.com)