/**
  * Serialize job to allow persistence
  *
  * The serialization format is a JSON object with keys "content",
  * "metadata" and "__name__". When a job is fetched from the SL, a job name
  * will be set and be available as metadata. An invokable job has no service
  * name and therefore the FQCN will be used.
  *
  * @param  JobInterface $job The job to persist
  * @return string
  */
 public function serializeJob(JobInterface $job)
 {
     $job->setMetadata('__name__', $job->getMetadata('__name__', get_class($job)));
     $data = ['content' => serialize($job->getContent()), 'metadata' => $job->getMetadata()];
     return json_encode($data);
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 public function delete(JobInterface $job)
 {
     $parameters = array('QueueUrl' => $this->queueOptions->getQueueUrl(), 'ReceiptHandle' => $job->getMetadata('receiptHandle'));
     $this->sqsClient->deleteMessage($parameters);
 }