PHP Class Disque\Queue\Queue

Exibir arquivo Open project: mariano/disque-php

Protected Properties

Property Type Description
$client Disque\Client Client
$name string Name

Public Methods

Method Description
__construct ( Client $client, string $name ) Create a queue
failed ( Disque\Queue\JobInterface $job ) : void Marks the job as failed and returns it to the queue
processed ( Disque\Queue\JobInterface $job ) : void Acknowledges a Job as properly handled
processing ( Disque\Queue\JobInterface $job ) : integer Marks that a Job is still being processed
pull ( integer $timeout ) : Disque\Queue\Job | null Pulls a single job from the queue (if none available, and if $timeout specified, then wait only this much time for a job, otherwise return null)
push ( Disque\Queue\JobInterface $job, array $options = [] ) : Disque\Queue\JobInterface Pushes a job into the queue
schedule ( Disque\Queue\JobInterface $job, DateTime $when ) : Disque\Queue\JobInterface Pushes a job into the queue, setting it to be up for processing only at the specific date & time.
setMarshaler ( Disque\Queue\Marshal\MarshalerInterface $marshaler ) : void Set Job marshaler

Private Methods

Method Description
checkConnected ( ) : void Check that we are connected to a node, and if not connect

Method Details

__construct() public method

Create a queue
public __construct ( Client $client, string $name )
$client Disque\Client Client
$name string Queue name

failed() public method

This increases the NACK counter of the job
public failed ( Disque\Queue\JobInterface $job ) : void
$job Disque\Queue\JobInterface
return void

processed() public method

Acknowledges a Job as properly handled
public processed ( Disque\Queue\JobInterface $job ) : void
$job Disque\Queue\JobInterface Job
return void

processing() public method

Marks that a Job is still being processed
public processing ( Disque\Queue\JobInterface $job ) : integer
$job Disque\Queue\JobInterface Job
return integer Number of seconds that the job visibility was postponed

pull() public method

Pulls a single job from the queue (if none available, and if $timeout specified, then wait only this much time for a job, otherwise return null)
public pull ( integer $timeout ) : Disque\Queue\Job | null
$timeout integer If specified, wait these many seconds
return Disque\Queue\Job | null A job, or null if no job was found before timeout

push() public method

Pushes a job into the queue
public push ( Disque\Queue\JobInterface $job, array $options = [] ) : Disque\Queue\JobInterface
$job Disque\Queue\JobInterface Job
$options array ADDJOB options sent to the client
return Disque\Queue\JobInterface Job pushed

schedule() public method

Pushes a job into the queue, setting it to be up for processing only at the specific date & time.
public schedule ( Disque\Queue\JobInterface $job, DateTime $when ) : Disque\Queue\JobInterface
$job Disque\Queue\JobInterface Job
$when DateTime Date & time on when job should be ready for processing
return Disque\Queue\JobInterface Job pushed

setMarshaler() public method

Set Job marshaler
public setMarshaler ( Disque\Queue\Marshal\MarshalerInterface $marshaler ) : void
$marshaler Disque\Queue\Marshal\MarshalerInterface
return void

Property Details

$client protected_oe property

Client
protected Client,Disque $client
return Disque\Client

$name protected_oe property

Name
protected string $name
return string