1Mojolicious::Plugin::MiUnsieorn(C3o)ntributed Perl DocumMeonjtoaltiicoinous::Plugin::Minion(3)
2
3
4

NAME

6       Mojolicious::Plugin::Minion - Minion job queue plugin
7

SYNOPSIS

9         # Mojolicious (choose a backend)
10         $self->plugin(Minion => {Pg => 'postgresql://postgres@/test'});
11
12         # Mojolicious::Lite (choose a backend)
13         plugin Minion => {Pg => 'postgresql://postgres@/test'};
14
15         # Share the database connection cache (PostgreSQL backend)
16         helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test') };
17         plugin Minion => {Pg => app->pg};
18
19         # Add tasks to your application
20         app->minion->add_task(slow_log => sub ($job, $msg) {
21           sleep 5;
22           $job->app->log->debug(qq{Received message "$msg"});
23         });
24
25         # Start jobs from anywhere in your application
26         $c->minion->enqueue(slow_log => ['test 123']);
27
28         # Perform jobs in your tests
29         $t->get_ok('/start_slow_log_job')->status_is(200);
30         $t->get_ok('/start_another_job')->status_is(200);
31         $t->app->minion->perform_jobs;
32

DESCRIPTION

34       Mojolicious::Plugin::Minion is a Mojolicious plugin for the Minion job
35       queue.
36

HELPERS

38       Mojolicious::Plugin::Minion implements the following helpers.
39
40   minion
41         my $minion = $app->minion;
42         my $minion = $c->minion;
43
44       Get Minion object for application.
45
46         # Add job to the queue
47         $c->minion->enqueue(foo => ['bar', 'baz']);
48
49         # Perform jobs for testing
50         $app->minion->perform_jobs;
51

METHODS

53       Mojolicious::Plugin::Minion inherits all methods from
54       Mojolicious::Plugin and implements the following new ones.
55
56   register
57         $plugin->register(Mojolicious->new, {Pg => 'postgresql://postgres@/test'});
58
59       Register plugin in Mojolicious application.
60

SEE ALSO

62       Minion, Minion::Guide, <https://minion.pm>, Mojolicious::Guides,
63       <https://mojolicious.org>.
64
65
66
67perl v5.38.0                      2023-07-20    Mojolicious::Plugin::Minion(3)
Impressum