The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Job::Machine::DB

VERSION

version 0.18

NAME

Job::Machine::DB - Database class for Job::Machine

METHODS

new

  my $client = Job::Machine::DB->new(
          dbh   => $dbh,
          queue => 'queue.subqueue',

  );

  my $client = Job::Machine::Base->new(
          dsn   => @dsn,
  );

set_listen

 $self->listen( queue => 'queue_name' );
 $self->listen( queue => \@queues, reply => 1  );

Sets up the listener. Quit listening to the named queues. If 'reply' is passed, we unlisten to the related reply queue instead of the task queue.

Return undef immediately if no queue is provided.

unlisten

 $self->unlisten( queue => 'queue_name' );
 $self->unlisten( queue => \@queues, reply => 1  );

Quit listening to the named queues. If 'reply' is passed, we unlisten to the related reply queue instead of the task queue.

Return undef immediately if no queue is provided.

notify

 $self->notify( queue => 'queue_name' );
 $self->notify( queue => 'queue_name', reply => 1, payload => $data  );

Sends an asynchronous notification to the named queue, with an optional payload. If 'reply' is true, then the queue names are taken to be reply.

Return undef immediately if no queue name is provided.

get_notification

 my $notifies = $self->get_notification();

Retrievies the pending notifications. The return value is an arrayref where each row looks like this:

 my ($name, $pid, $payload) = @$notify;

AUTHOR

Kaare Rasmussen <kaare at cpan dot net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Kaare Rasmussen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.