1 | <?php |
||
19 | class CpeSqsWriter |
||
20 | { |
||
21 | private $debug; |
||
22 | private $sqs; |
||
23 | |||
24 | // Exceptions |
||
25 | const INVALID_JSON = "INVALID_JSON"; |
||
26 | |||
27 | // Statuses |
||
28 | const WORKFLOW_SCHEDULED = "WORKFLOW_SCHEDULED"; |
||
29 | const JOB_STARTED = "JOB_STARTED"; |
||
30 | const JOB_COMPLETED = "JOB_COMPLETED"; |
||
31 | const JOB_FAILED = "JOB_FAILED"; |
||
32 | const ACTIVITY_STARTED = "ACTIVITY_STARTED"; |
||
33 | const ACTIVITY_FAILED = "ACTIVITY_FAILED"; |
||
34 | const ACTIVITY_TIMEOUT = "ACTIVITY_TIMEOUT"; |
||
35 | const ACTIVITY_COMPLETED = "ACTIVITY_COMPLETED"; |
||
36 | const ACTIVITY_PROGRESS = "ACTIVITY_PROGRESS"; |
||
37 | const ACTIVITY_PREPARING = "ACTIVITY_PREPARING"; |
||
38 | const ACTIVITY_FINISHING = "ACTIVITY_FINISHING"; |
||
39 | |||
40 | public function __construct($debug) |
||
50 | |||
51 | |||
52 | /** |
||
53 | * SEND messages to OUTPUT SQS queue |
||
54 | * |
||
55 | * Send messages to back to the clients. |
||
56 | * Clients listening to the SQS queue will receive them |
||
57 | * Send updates and notifications: |
||
58 | * Activity Started, Failed, Succeeded, etc |
||
59 | */ |
||
60 | |||
61 | public function workflow_scheduled($workflowType, $runId, $workflowId, $message) |
||
79 | |||
80 | public function activity_started($task) |
||
89 | |||
90 | public function activity_completed($task, $result = null) |
||
100 | |||
101 | public function activity_failed($task, $reason, $details) |
||
113 | |||
114 | public function activity_timeout($task) |
||
122 | |||
123 | public function activity_canceled($task) |
||
127 | |||
128 | public function activity_progress($task, $progress) |
||
137 | |||
138 | public function activity_preparing($task) |
||
145 | |||
146 | public function activity_finishing($task) |
||
153 | |||
154 | |||
155 | /** |
||
156 | * UTILS |
||
157 | */ |
||
158 | |||
159 | // Craft a new message array |
||
160 | private function craft_new_msg($type, $data) |
||
170 | |||
171 | // Send a message to SQS output queue |
||
172 | private function send_activity_msg( |
||
213 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.