GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MINION::WORKER (3)

.ds Aq ’

NAME

Minion::Worker - Minion worker

CONTENTS

SYNOPSIS



  use Minion::Worker;

  my $worker = Minion::Worker->new(minion => $minion);



DESCRIPTION

Minion::Worker performs jobs for Minion.

EVENTS

Minion::Worker inherits all events from Mojo::EventEmitter and can emit the following new ones.

    dequeue



  $worker->on(dequeue => sub {
    my ($worker, $job) = @_;
    ...
  });



Emitted in the worker process after a job has been dequeued.



  $worker->on(dequeue => sub {
    my ($worker, $job) = @_;
    my $id = $job->id;
    say "Job $id has been dequeued.";
  });



ATTRIBUTES

Minion::Worker implements the following attributes.

    id



  my $id  = $worker->id;
  $worker = $worker->id($id);



Worker id.

    minion



  my $minion = $worker->minion;
  $worker    = $worker->minion(Minion->new);



Minion object this worker belongs to.

METHODS

Minion::Worker inherits all methods from Mojo::EventEmitter and implements the following new ones.

    dequeue



  my $job = $worker->dequeue(0.5);
  my $job = $worker->dequeue(0.5 => {queues => [important]});



Wait a given amount of time in seconds for a job, dequeue Minion::Job object and transition from inactive to active state, or return undef if queues were empty.

These options are currently available:
queues


  queues => [important]



One or more queues to dequeue jobs from, defaults to default.

    info



  my $info = $worker->info;



Get worker information.



  # Check worker host
  my $host = $worker->info->{host};



These fields are currently available:
host


  host => localhost



Worker host.

jobs


  jobs => [10023, 10024, 10025, 10029]



Ids of jobs the worker is currently processing.

notified


  notified => 784111777



Last time worker sent a heartbeat.

pid


  pid => 12345



Process id of worker.

started


  started => 784111777



Time worker was started.

    register



  $worker = $worker->register;



Register worker or send heartbeat to show that this worker is still alive.

    unregister



  $worker = $worker->unregister;



Unregister worker.

SEE ALSO

Minion, Mojolicious::Guides, <http://mojolicious.org>.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MINION::WORKER (3) 2016-02-05

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.