Skip to content

Instantly share code, notes, and snippets.

@raulp
Last active May 19, 2017 20:51
Show Gist options
  • Save raulp/6050423 to your computer and use it in GitHub Desktop.
Save raulp/6050423 to your computer and use it in GitHub Desktop.
Laravel Queue::push return job id
// For IronIO
// file src/Illuminate/Queue/IronQueue.php line 64
public function push($job, $data = '', $queue = null)
{
$payload = $this->createPayload($job, $data);
$response = $this->iron->postMessage($this->getQueue($queue), $payload);
return $response->id;
}
// For Amazon SQS
// file src/Illuminate/Queue/SqsQueue.php line 43
public function push($job, $data = '', $queue = null)
{
$payload = $this->createPayload($job, $data);
$response = $this->sqs->sendMessage(array('QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload));
return $response->get('MessageId');
}
// For Beanstalkd server
// file src/Illuminate/Queue/BeanstalkdQueue.php line 44
public function push($job, $data = '', $queue = null)
{
$payload = $this->createPayload($job, $data);
return $this->pheanstalk->useTube($this->getQueue($queue))->put($payload);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment