Last active
December 28, 2015 16:29
-
-
Save bwaidelich/7529779 to your computer and use it in GitHub Desktop.
Example usage for the ``TYPO3.JobQueue.Common`` TYPO3 Flow package (Annotation)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TYPO3: | |
| Jobqueue: | |
| Common: | |
| queues: | |
| 'test': | |
| className: 'TYPO3\Jobqueue\Beanstalkd\Queue\BeanstalkdQueue' # or TYPO3\Jobqueue\Redis\Queue\RedisQueue, ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Acme\JobQueueTest\Controller; | |
| /* * | |
| * This script belongs to the TYPO3 Flow package "Acme.JobQueueTest". * | |
| * * | |
| * */ | |
| use TYPO3\Flow\Annotations as Flow; | |
| use TYPO3\Flow\Mvc\Controller\ActionController; | |
| use TYPO3\Jobqueue\Common\Annotations as Queue; | |
| use TYPO3\Flow\Utility\Files; | |
| class StandardController extends ActionController { | |
| /** | |
| * @param string $text | |
| * @return void | |
| */ | |
| public function indexAction($text = 'default') { | |
| $this->createPdf($text); | |
| return 'Done!'; | |
| } | |
| /** | |
| * @Queue\Defer("test") | |
| * @param string $text | |
| * @return void | |
| */ | |
| public function createPdf($text) { | |
| $filename = uniqid('pdf') . '.txt'; | |
| file_put_contents(Files::concatenatePaths(array(FLOW_PATH_DATA, $filename)), $text); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: