https://github.com/mborders/artifex
Simple in-memory job queue for Golang using worker-based dispatching
https://github.com/mborders/artifex
golang job-scheduler job-worker queue-workers
Last synced: 2 months ago
JSON representation
Simple in-memory job queue for Golang using worker-based dispatching
- Host: GitHub
- URL: https://github.com/mborders/artifex
- Owner: mborders
- License: mit
- Created: 2018-10-31T19:34:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-19T20:24:38.000Z (over 1 year ago)
- Last Synced: 2025-12-25T13:52:33.545Z (3 months ago)
- Topics: golang, job-scheduler, job-worker, queue-workers
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 213
- Watchers: 10
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - mborders/artifex - memory job queue for Golang using worker-based dispatching ☆`214` (Goroutines / Search and Analytic Databases)
- awesome-go-info - artifex - memory job queue for Golang using worker-based dispatching. | (Relational Databases)
- awesome-go-extra - artifex - memory job queue for Golang using worker-based dispatching|133|10|0|2018-10-31T19:34:31Z|2020-08-18T21:33:48Z| (Goroutines / Advanced Console UIs)
README
[](http://godoc.org/github.com/mborders/artifex)
[](https://travis-ci.org/mborders/artifex)
[](https://goreportcard.com/report/github.com/mborders/artifex)
[](https://codecov.io/gh/mborders/artifex)
# artifex
Simple in-memory job queue for Golang using worker-based dispatching
Documentation here: https://godoc.org/github.com/mborders/artifex
Cron jobs use the robfig/cron library: https://godoc.org/github.com/robfig/cron
## Example Usage
```go
// 10 workers, 100 max in job queue
d := artifex.NewDispatcher(10, 100)
d.Start()
d.Dispatch(func() {
// do something
})
err := d.DispatchIn(func() {
// do something in 500ms
}, time.Millisecond*500)
// Returns a DispatchTicker
dt, err := d.DispatchEvery(func() {
// do something every 250ms
}, time.Millisecond*250)
// Stop a given DispatchTicker
dt.Stop()
// Returns a DispatchCron
dc, err := d.DispatchCron(func() {
// do something every 1s
}, "*/1 * * * * *")
// Stop a given DispatchCron
dc.Stop()
// Stop a dispatcher and all its workers/tickers
d.Stop()
```