-
-
28 Apr 2022 15:19:54 UTC
- Distribution: Minion
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (287 / 0 / 9)
- Kwalitee
Bus factor: 2- 26.91% Coverage
- License: artistic_2
- Perl: v5.16.0
- Activity
24 month- Tools
- Download (1.62MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Mojolicious::Plugin::Minion - Minion job queue plugin
SYNOPSIS
# 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;
DESCRIPTION
Mojolicious::Plugin::Minion is a Mojolicious plugin for the Minion job queue.
HELPERS
Mojolicious::Plugin::Minion implements the following helpers.
minion
my $minion = $app->minion; my $minion = $c->minion;
Get Minion object for application.
# Add job to the queue $c->minion->enqueue(foo => ['bar', 'baz']); # Perform jobs for testing $app->minion->perform_jobs;
METHODS
Mojolicious::Plugin::Minion inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register(Mojolicious->new, {Pg => 'postgresql://postgres@/test'});
Register plugin in Mojolicious application.
SEE ALSO
Minion, Minion::Guide, https://minion.pm, Mojolicious::Guides, https://mojolicious.org.
Module Install Instructions
To install Minion, copy and paste the appropriate command in to your terminal.
cpanm Minion
perl -MCPAN -e shell install Minion
For more information on module installation, please visit the detailed CPAN module installation guide.