Created
October 16, 2010 18:24
-
-
Save masartz/630119 to your computer and use it in GitHub Desktop.
YAPC::Asia Qudo::Plugin::Logger&Qudo::Hook::Notify demo script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Qudo; | |
my $qudo = Qudo->new( | |
driver_class => 'Skinny', | |
databases => [+{ | |
dsn => 'dbi:mysql:qudo', | |
username => 'root', | |
password => '', | |
}], | |
); | |
$qudo->enqueue("MyApp::Worker::Abort", { arg => 'arg' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Qudo; | |
use MyApp::Worker::Abort; | |
my $qudo = Qudo->new( | |
driver_class => 'Skinny', | |
databases => [+{ | |
dsn => 'dbi:mysql:qudo', | |
username => 'root', | |
password => '', | |
}], | |
manager_abilities => [qw/MyApp::Worker::Abort /], | |
); | |
$qudo->manager->register_hooks(qw/Qudo::Hook::Notify::Abort/); | |
$qudo->manager->register_plugins( | |
+{ | |
name => 'Qudo::Plugin::Logger', | |
option => +{ | |
dispatchers => ['screen'], | |
screen => { | |
class => 'Log::Dispatch::Screen', | |
min_level => 'debug', | |
stderr => 0, | |
}, | |
}, | |
} | |
); | |
$qudo->manager->work_once; | |
package MyApp::Worker::Abort; | |
use strict; | |
use warnings; | |
use base qw/Qudo::Worker/; | |
sub work { | |
my ($self , $job ) = @_; | |
$job->abort(); | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment