I'm trying to make an api with cakephp 3. With this api I'll send some information for batch email to the system. After storing the api request into databse I want to return an acknowledgement that the request has received and start batch processing. After finishing the processing I want to send a callback response to return the process status. In my current coding system I've to wait to finish the process. How can I do it parallely?
// Store api request to database
$saveQueue = EmailQueue::enqueue($to, $data, $options);
if ($saveQueue) {
$this->Flash->success('Request saved in queue.');
$shell = new ShellDispatcher();
$output = $shell->run(['cake', 'EmailQueue.sender']);
if (0 === $output) {
$this->Flash->success('Success from shell command.');
} else {
$this->Flash->error('Failure from shell command.');
}
return;
}
$this->Flash->error('Failed to save in queue.');
[I'm not sure what should be the actual question title, feel free to edit. :) ]