PHP 클래스 UrbanIndo\Yii2\Queue\Queue

부터: 2015.02.24
저자: Petra Barus ([email protected])
상속: extends yii\base\Component
파일 보기 프로젝트 열기: urbanindo/yii2-queue 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$module yii\base\Module To add the module, create a new module in the config e.g. create a module named 'task'. 'modules' => [ 'task' => [ 'class' => 'app\modules\task\Module', ] ] and then add the module to the queue config. 'components' => [ 'queue' => [ 'module' => 'task' ] ]
$releaseOnFailure boolean This will release automatically on execution failure. i.e. when the run method returns false or catch exception.
$serializer string Choose the serializer.

공개 메소드들

메소드 설명
delete ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Delete the job. This will trigger event EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE.
fetch ( ) : UrbanIndo\Yii2\Queue\Job | boolean Return next job from the queue. This will trigger event EVENT_BEFORE_FETCH and event EVENT_AFTER_FETCH
getSize ( ) : integer Returns the number of queue size.
init ( ) : void Initializes the module.
post ( UrbanIndo\Yii2\Queue\Job &$job ) : boolean Post new job to the queue. This will trigger event EVENT_BEFORE_POST and EVENT_AFTER_POST.
purge ( ) : boolean Purge the whole queue.
release ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Release the job. This will trigger event EVENT_BEFORE_RELEASE and EVENT_AFTER_RELEASE.
run ( UrbanIndo\Yii2\Queue\Job $job ) : void Run the job.

보호된 메소드들

메소드 설명
deleteJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Delete the job. Override this for the queue implementation.
deserialize ( string $message ) : UrbanIndo\Yii2\Queue\Job Deserialize job to be executed.
deserializeMessage ( array $array ) : array
fetchJob ( ) : UrbanIndo\Yii2\Queue\Job | boolean Return next job from the queue. Override this for queue implementation.
postJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Post new job to the queue. Override this for queue implementation.
releaseJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean Release the job. Override this for the queue implementation.
serialize ( UrbanIndo\Yii2\Queue\Job $job ) : string Pack job so that it can be send.
serializeMessage ( mixed $array ) : array

메소드 상세

delete() 공개 메소드

Delete the job. This will trigger event EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE.
public delete ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
리턴 boolean whether the operation succeed.

deleteJob() 추상적인 보호된 메소드

Delete the job. Override this for the queue implementation.
abstract protected deleteJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
리턴 boolean whether the operation succeed.

deserialize() 보호된 메소드

Deserialize job to be executed.
protected deserialize ( string $message ) : UrbanIndo\Yii2\Queue\Job
$message string The json string.
리턴 UrbanIndo\Yii2\Queue\Job The job.

deserializeMessage() 보호된 메소드

protected deserializeMessage ( array $array ) : array
$array array The message to be deserialize.
리턴 array

fetch() 공개 메소드

Return next job from the queue. This will trigger event EVENT_BEFORE_FETCH and event EVENT_AFTER_FETCH
public fetch ( ) : UrbanIndo\Yii2\Queue\Job | boolean
리턴 UrbanIndo\Yii2\Queue\Job | boolean the job or false if not found.

fetchJob() 추상적인 보호된 메소드

Return next job from the queue. Override this for queue implementation.
abstract protected fetchJob ( ) : UrbanIndo\Yii2\Queue\Job | boolean
리턴 UrbanIndo\Yii2\Queue\Job | boolean the job or false if not found.

getSize() 추상적인 공개 메소드

Returns the number of queue size.
abstract public getSize ( ) : integer
리턴 integer

init() 공개 메소드

Initializes the module.
public init ( ) : void
리턴 void

post() 공개 메소드

Post new job to the queue. This will trigger event EVENT_BEFORE_POST and EVENT_AFTER_POST.
public post ( UrbanIndo\Yii2\Queue\Job &$job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job.
리턴 boolean Whether operation succeed.

postJob() 추상적인 보호된 메소드

Post new job to the queue. Override this for queue implementation.
abstract protected postJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job.
리턴 boolean Whether operation succeed.

purge() 추상적인 공개 메소드

Purge the whole queue.
abstract public purge ( ) : boolean
리턴 boolean

release() 공개 메소드

Release the job. This will trigger event EVENT_BEFORE_RELEASE and EVENT_AFTER_RELEASE.
public release ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to delete.
리턴 boolean whether the operation succeed.

releaseJob() 추상적인 보호된 메소드

Release the job. Override this for the queue implementation.
abstract protected releaseJob ( UrbanIndo\Yii2\Queue\Job $job ) : boolean
$job UrbanIndo\Yii2\Queue\Job The job to release.
리턴 boolean whether the operation succeed.

run() 공개 메소드

Run the job.
public run ( UrbanIndo\Yii2\Queue\Job $job ) : void
$job UrbanIndo\Yii2\Queue\Job The job to be executed.
리턴 void

serialize() 보호된 메소드

Pack job so that it can be send.
protected serialize ( UrbanIndo\Yii2\Queue\Job $job ) : string
$job UrbanIndo\Yii2\Queue\Job The job to serialize.
리턴 string JSON string.

serializeMessage() 보호된 메소드

protected serializeMessage ( mixed $array ) : array
$array mixed Array to serialize.
리턴 array

프로퍼티 상세

$module 공개적으로 프로퍼티

To add the module, create a new module in the config e.g. create a module named 'task'. 'modules' => [ 'task' => [ 'class' => 'app\modules\task\Module', ] ] and then add the module to the queue config. 'components' => [ 'queue' => [ 'module' => 'task' ] ]
public Module,yii\base $module
리턴 yii\base\Module

$releaseOnFailure 공개적으로 프로퍼티

This will release automatically on execution failure. i.e. when the run method returns false or catch exception.
public bool $releaseOnFailure
리턴 boolean

$serializer 공개적으로 프로퍼티

Choose the serializer.
public string $serializer
리턴 string