zend framework2 - ZF2 trigger service or event in background -
maybe knows how best tackle problem.
i have zf2 application in client can upload file. file contains orders , needs processed. if trigger event starts processing file right away, client cannot move on (to other things). trigger event in background starts processing file while action returns next page client or can go on , fill in other stuff. of course can solve cron jobs... maybe there way zf2 more event driven? possible trigger event (or service) in background so:
public function csvuploadaction() { $id = (int) $this->params()->fromroute('id', 0); $form = new csvform($id); // validating , 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 solution can't find (other using cron jobs). idea? thank very time!
bram correct, want work queue.
you might @ slmqueue, zf2 module of queue-abstraction layer (with back-ends beanstalkd, amazon sqs, , doctrineorm, currently), if not use it, @ least inspiration. i'm using beanstalkd, results.
you could, of course, simplify, , use beanstalkd directly, via pheanstalk client library php.
Comments
Post a Comment