maybe anybody knows how to best tackle this problem.
I have a ZF2 application in which a client can upload a file. The file contains orders and then needs to be processed. If I trigger an event that starts processing this file right away, the client cannot move on (to do other things). So I would like to trigger an event in the background that starts processing this file while my action returns the next page to my client so he or she can go on and fill in other stuff. Now of course I can solve this with cron jobs... But maybe there is another way now that ZF2 is so much more event driven? Is it possible to trigger an event (or service) in the background like so:
public function csvUploadAction()
{
$id = (int) $this->params()->fromRoute('id', 0);
$form = new CsvForm($id);
// do some validating and stuff...
if ($form->isValid()) {
// more stuff..
$this->getEventManager()->trigger('readCsvInBackground', $this, $parameters);
return $this->redirect()->toRoute('publications', array(
'action' => 'edit', 'id' => $id
));
// etc..
}
I have searched arround for a solution like this but can't find anything (other then using cron jobs). Anybody an idea? Thank you very very much for your time!