Mojolic...::Minion(3)
π Mojolic...::Minion(3) π
okay bestie, this is a page from the User Contributed Perl Documentation set, and it's all about the plugin that plugs a whole job queue into your Mojolicious app. no cap. let's get into it.
β¨ NAME β¨
Mojolicious::Plugin::Minion β the Minion job queue plugin, fr fr π
πΈ SYNOPSIS πΈ
like, here's the whole vibe in code form:
# Mojolicious (choose a backend)
$self->plugin(Minion => {Pg => 'postgresql://postgres@/test'});
# Mojolicious::Lite (choose a backend)
plugin Minion => {Pg => 'postgresql://postgres@/test'};
# Share the database connection cache (PostgreSQL backend)
helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test') };
plugin Minion => {Pg => app->pg};
# Add tasks to your application
app->minion->add_task(slow_log => sub ($job, $msg) {
sleep 5;
$job->app->log->debug(qq{Received message "$msg"});
});
# Start jobs from anywhere in your application
$c->minion->enqueue(slow_log => ['test 123']);
# Perform jobs in your tests
$t->get_ok('/start_slow_log_job')->status_is(200);
$t->get_ok('/start_another_job')->status_is(200);
$t->app->minion->perform_jobs;
notice how we choose a backend both times? that's the move. and yes, you can share the database connection cache with the PostgreSQL backend. iconic. π¦
π DESCRIPTION π
Mojolicious::Plugin::Minion is a Mojolicious plugin for the Minion job queue. that's it, that's the whole description, and honestly? it understood the assignment. π
β HELPERS β
Mojolicious::Plugin::Minion implements the following helpers. not a lot, but she's serving.
π«Ά minion
my $minion = $app->minion;
my $minion = $c->minion;
Get the Minion object for your application. literally grab it from either spot, no drama.
# Add job to the queue
$c->minion->enqueue(foo => ['bar', 'baz']);
# Perform jobs for testing
$app->minion->perform_jobs;
enqueue when you're out here living your life, perform_jobs when you're testing. both valid. both slay. π₯
π METHODS π
Mojolicious::Plugin::Minion inherits all methods from Mojolicious::Plugin and implements the following new ones. inherited plus extra, the way that growth works. π
π register
$plugin->register(Mojolicious->new, {Pg => 'postgresql://postgres@/test'});
Register the plugin in a Mojolicious application. one line, whole job queue unlocked. main character energy. β¨
π SEE ALSO π
- Minion
- Minion::Guide
- <https://minion.pm>
- Mojolicious::Guides
- <https://mojolicious.org>
go read those too, iykyk π
no warnings, no bugs, no deprecated anything on this page β just pure clean plugin energy. we love to see it π
and that's the whole page, bestie!! this one came to you courtesy of perl v5.42.0, dated 2026-01-17 β so if you're reading this on a date that is not that date, hi from the future/past, the vibe still holds. periodt. π ππ¦
π¦ where this page comes from
- fedora 44: perl-Minion 11.0-2.fc44 Β· Artistic-2.0 AND CC-BY-SA-4.0 AND MIT AND ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms