An open API service indexing awesome lists of open source software.

https://github.com/tinh-tinh/queue

🛢 Queu Module for Tinh Tinh
https://github.com/tinh-tinh/queue

framework queue redis

Last synced: 3 months ago
JSON representation

🛢 Queu Module for Tinh Tinh

Awesome Lists containing this project

README

          

# Queue Module for Tinh Tinh


GitHub Release
GitHub License



Go Reference


Tinh Tinh Logo

## Overview

The Queue module provides a robust, Redis-based job queue for the Tinh Tinh framework, supporting job scheduling, rate limiting, retries, concurrency, delayed jobs, priorities, and more.

## Install

```bash
go get -u github.com/tinh-tinh/queue/v2
```

## Features

- **Redis-Based:** Robust persistence and distributed processing.
- **Delayed Jobs:** Schedule jobs to run after a delay.
- **Cron Scheduling:** Schedule and repeat jobs using cron patterns.
- **Rate Limiting:** Control job processing rate.
- **Retries:** Automatic retry on failure.
- **Priority:** Job prioritization.
- **Concurrency:** Multiple workers per queue.
- **Pause/Resume:** Temporarily stop and resume job processing.
- **Crash Recovery:** Recovers jobs after process crashes.
- **Remove on Complete/Fail:** Clean up jobs after handling.

## Quick Start

### 1. Register the Module

```go
import "github.com/tinh-tinh/queue/v2"

queueModule := queue.ForRoot(&queue.Options{
Connect: &redis.Options{
Addr: "localhost:6379",
DB: 0,
},
Workers: 3,
RetryFailures: 3,
})
```

Or via factory:

```go
queueModule := queue.ForRootFactory(func(ref core.RefProvider) *queue.Options {
return &queue.Options{ /* ... */ }
})
```

### 2. Register and Inject Queues

```go
userQueueModule := queue.Register("user") // uses default/global options

// In your service or controller:
userQueue := queue.Inject(module, "user")
```

## Contributing

We welcome contributions! Please feel free to submit a Pull Request.

## Support

If you encounter any issues or need help, you can:
- Open an issue in the GitHub repository
- Check our documentation
- Join our community discussions