Skip to content

Commit 701128e

Browse files
committed
Add ReserverInterface.
This interface allows implementations to define different behaviours for reserving jobs from the queues.
1 parent cf187fa commit 701128e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Resque\Reserver;
4+
5+
use Resque_Job;
6+
7+
/**
8+
* A reserver implements a specific behaviour for reserving jobs from its queues.
9+
* Resque_Worker will call the reserve() method to obtain a reserved job.
10+
*/
11+
interface ReserverInterface
12+
{
13+
/**
14+
* Gets the queues to reserve jobs from.
15+
*
16+
* @return array
17+
*/
18+
public function getQueues();
19+
20+
/**
21+
* Reserves a job.
22+
*
23+
* @return Resque_Job|null A job instance or null if not job was available to reserve.
24+
*/
25+
public function reserve();
26+
27+
/**
28+
* If there was no job available to reserve, should the worker wait before attempting to reserve a job again?
29+
*
30+
* @return bool
31+
*/
32+
public function waitAfterReservationAttempt();
33+
34+
/**
35+
* Gets a friendly name of this reserver.
36+
*
37+
* @return string
38+
*/
39+
public function getName();
40+
}

0 commit comments

Comments
 (0)