|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Gearman Bundle for Symfony2 / Symfony3 |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
* |
|
9
|
|
|
* Feel free to edit as you please, and have fun. |
|
10
|
|
|
* |
|
11
|
|
|
* @author Marc Morera <[email protected]> |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Mkk\GearmanBundle; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Events dispatched by GearmanBundle |
|
18
|
|
|
*/ |
|
19
|
|
|
class GearmanEvents |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Sets the callback function to be used when a task is completed |
|
23
|
|
|
* |
|
24
|
|
|
* event.name : gearman.client.callback.complete |
|
25
|
|
|
* event.class : GearmanClientCallbackCompleteEvent |
|
26
|
|
|
* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
const GEARMAN_CLIENT_CALLBACK_COMPLETE = 'gearman.client.callback.complete'; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Sets the callback function to be used when a task does not complete |
|
33
|
|
|
* successfully |
|
34
|
|
|
* |
|
35
|
|
|
* event.name : gearman.client.callback.fail |
|
36
|
|
|
* event.class : GearmanClientCallbackFailEvent |
|
37
|
|
|
* |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
const GEARMAN_CLIENT_CALLBACK_FAIL = 'gearman.client.callback.fail'; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Sets the callback function for accepting data packets for a task |
|
44
|
|
|
* |
|
45
|
|
|
* event.name : gearman.client.callback.data |
|
46
|
|
|
* event.class : GearmanClientCallbackDataEvent |
|
47
|
|
|
* |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
const GEARMAN_CLIENT_CALLBACK_DATA = 'gearman.client.callback.data'; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Sets a function to be called when a task is received and queued by the |
|
54
|
|
|
* Gearman job server |
|
55
|
|
|
* |
|
56
|
|
|
* event.name : gearman.client.callback.created |
|
57
|
|
|
* event.class : GearmanClientCallbackCreatedEvent |
|
58
|
|
|
* |
|
59
|
|
|
* @var string |
|
60
|
|
|
*/ |
|
61
|
|
|
const GEARMAN_CLIENT_CALLBACK_CREATED = 'gearman.client.callback.created'; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Specifies a function to call when a worker for a task sends an exception |
|
65
|
|
|
* |
|
66
|
|
|
* event.name : gearman.client.callback.exception |
|
67
|
|
|
* event.class : GearmanClientCallbackExceptionEvent |
|
68
|
|
|
* |
|
69
|
|
|
* @var string |
|
70
|
|
|
*/ |
|
71
|
|
|
const GEARMAN_CLIENT_CALLBACK_EXCEPTION = 'gearman.client.callback.exception'; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Sets a callback function used for getting updated status information from |
|
75
|
|
|
* a worker |
|
76
|
|
|
* |
|
77
|
|
|
* event.name : gearman.client.callback.status |
|
78
|
|
|
* event.class : GearmanClientCallbackStatusEvent |
|
79
|
|
|
* |
|
80
|
|
|
* @var string |
|
81
|
|
|
*/ |
|
82
|
|
|
const GEARMAN_CLIENT_CALLBACK_STATUS = 'gearman.client.callback.status'; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Sets a function to be called when a worker sends a warning |
|
86
|
|
|
* |
|
87
|
|
|
* event.name : gearman.client.callback.warning |
|
88
|
|
|
* event.class : GearmanClientCallbackWarningEvent |
|
89
|
|
|
* |
|
90
|
|
|
* @var string |
|
91
|
|
|
*/ |
|
92
|
|
|
const GEARMAN_CLIENT_CALLBACK_WARNING = 'gearman.client.callback.warning'; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Sets a function to be called when a worker needs to send back data prior |
|
96
|
|
|
* to job completion. |
|
97
|
|
|
* |
|
98
|
|
|
* A worker can do this when it needs to send updates, send partial results, |
|
99
|
|
|
* or flush data during long running jobs |
|
100
|
|
|
* |
|
101
|
|
|
* event.name : gearman.client.callback.workload |
|
102
|
|
|
* event.class : GearmanClientCallbackWorkloadEvent |
|
103
|
|
|
* |
|
104
|
|
|
* @var string |
|
105
|
|
|
*/ |
|
106
|
|
|
const GEARMAN_CLIENT_CALLBACK_WORKLOAD = 'gearman.client.callback.workload'; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Sets a function to be called when a worker has completed a job. |
|
110
|
|
|
* |
|
111
|
|
|
* This will be fired by the worker after completion of a job before preparing to start another work cycle. |
|
112
|
|
|
* |
|
113
|
|
|
* @var string |
|
114
|
|
|
*/ |
|
115
|
|
|
const GEARMAN_WORK_EXECUTED = 'gearman.work.executed'; |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Sets a function to be called when a worker is starting a job. |
|
119
|
|
|
* |
|
120
|
|
|
* This will be fired when the worker start another work cycle. |
|
121
|
|
|
* |
|
122
|
|
|
* @var string |
|
123
|
|
|
*/ |
|
124
|
|
|
const GEARMAN_WORK_STARTING = 'gearman.work.starting'; |
|
125
|
|
|
} |
|
|
|
|
|
|
126
|
|
|
|
This check marks files that end in a newline character, i.e. an empy line.