Beispiel #1
0
 /**
  * Generates Celery task-id and serializes task call into a message.
  *
  * @param string $taskName Celery task name.
  * @param array  $kwargs   Optional Celery task parameters.
  *
  * @return [taskId, messageBody] A pair of task-id and call message body.
  */
 private function prepareCeleryTask($taskName, array $kwargs = null)
 {
     $taskId = str_replace('-', '', self::newUUID4());
     // Celery replaces '-' in task id
     $task = ['id' => $taskId, 'task' => $taskName, 'args' => [], 'kwargs' => (object) $kwargs ?: new \stdClass()];
     return [$taskId, Util::jsonEncode($task)];
 }
Beispiel #2
0
 /**
  * Generates Celery task-id and serializes task call into a message.
  * 
  * @param string $taskName Celery task name
  * @param array $kwargs optional Celery task parameters
  * @return [taskId, messageBody] task-id and call message body
  */
 private function prepareCeleryTask($taskName, $kwargs = null)
 {
     $taskId = uniqid('php_', true);
     $task = ['id' => $taskId, 'task' => $taskName, 'args' => [], 'kwargs' => $kwargs ?: new \stdClass()];
     return [$taskId, Util::jsonEncode($task)];
 }