README.md
1
2# Minion [![](https://github.com/mojolicious/minion/workflows/linux/badge.svg)](https://github.com/mojolicious/minion/actions)
3
4![Screenshot](https://raw.github.com/mojolicious/minion/main/examples/admin.png?raw=true)
5
6 A high performance job queue for the Perl programming language, with support for multiple named queues, priorities,
7 high priority fast lane, delayed jobs, job dependencies, job progress, job results, retries with backoff, rate
8 limiting, unique jobs, expiring jobs, statistics, distributed workers, parallel processing, autoscaling, remote
9 control, [Mojolicious](https://mojolicious.org) admin ui, resource leak protection and multiple backends (such as
10 [PostgreSQL](https://www.postgresql.org)).
11
12 Job queues allow you to process time and/or computationally intensive tasks in background processes, outside of the
13 request/response lifecycle of web applications. Among those tasks you'll commonly find image resizing, spam filtering,
14 HTTP downloads, building tarballs, warming caches and basically everything else you can imagine that's not super fast.
15
16```perl
17use Mojolicious::Lite -signatures;
18
19plugin Minion => {Pg => 'postgresql://postgres@/test'};
20
21# Slow task
22app->minion->add_task(slow_log => sub ($job, $msg) {
23 sleep 5;
24 $job->app->log->debug(qq{Received message "$msg"});
25});
26
27# Perform job in a background worker process
28get '/log' => sub ($c) {
29 $c->minion->enqueue(slow_log => [$c->param('msg') // 'no message']);
30 $c->render(text => 'Your message will be logged soon.');
31};
32
33app->start;
34```
35
36 Just start one or more background worker processes in addition to your web server.
37
38 $ ./myapp.pl minion worker
39
40## Installation
41
42 All you need is a one-liner, it takes less than a minute.
43
44 $ curl -L https://cpanmin.us | perl - -M https://cpan.metacpan.org -n Minion
45
46 We recommend the use of a [Perlbrew](http://perlbrew.pl) environment.
47
48## Want to know more?
49
50 Take a look at our excellent [documentation](https://mojolicious.org/perldoc/Minion/Guide)!
51