File perl-Minion.spec of Package perl-Minion
#
# spec file for package perl-Minion
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Minion
Version: 2.01
Release: 0
%define cpan_name Minion
Summary: Job queue
License: Artistic-2.0
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Minion/
Source0: http://www.cpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(DBM::Deep) >= 2.0011
BuildRequires: perl(Mojolicious) >= 6.0
Requires: perl(DBM::Deep) >= 2.0011
Requires: perl(Mojolicious) >= 6.0
%{perl_requires}
%description
the Minion manpage is a job queue for the http://mojolicio.us real-time web
framework with support for multiple backends, such as the DBM::Deep manpage
and http://www.postgresql.org.
A job queue allows you to process time and/or computationally intensive
tasks in background processes, outside of the request/response lifecycle.
Among those tasks you'll commonly find image resizing, spam filtering, HTTP
downloads, building tarballs, warming caches and basically everything else
you can imagine that's not super fast.
use Mojolicious::Lite;
plugin Minion => {Pg => 'postgresql://sri:s3cret@localhost/test'};
# Slow task
app->minion->add_task(poke_mojo => sub {
my $job = shift;
$job->app->ua->get('mojolicio.us');
$job->app->log->debug('We have poked mojolicio.us for a visitor');
});
# Perform job in a background worker process
get '/' => sub {
my $c = shift;
$c->minion->enqueue('poke_mojo');
$c->render(text => 'We will poke mojolicio.us for you soon.');
};
app->start;
Background worker processes are usually started with the command the
Minion::Command::minion::worker manpage, which becomes automatically
available when an application loads the plugin the
Mojolicious::Plugin::Minion manpage.
$ ./myapp.pl minion worker
Jobs can be managed right from the command line with the
Minion::Command::minion::job manpage.
$ ./myapp.pl minion job
Every job can fail or succeed, but not get lost, the system is eventually
consistent and will preserve job results for as long as you like, depending
on the /"remove_after" manpage. While individual workers can fail in the
middle of processing a job, the system will detect this and ensure that no
job is left in an uncertain state, depending on the /"missing_after"
manpage.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes CONTRIBUTING.md LICENSE README.md
%changelog