Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
Last active December 28, 2015 16:29
Show Gist options
  • Select an option

  • Save bwaidelich/7529779 to your computer and use it in GitHub Desktop.

Select an option

Save bwaidelich/7529779 to your computer and use it in GitHub Desktop.
Example usage for the ``TYPO3.JobQueue.Common`` TYPO3 Flow package (Annotation)
TYPO3:
Jobqueue:
Common:
queues:
'test':
className: 'TYPO3\Jobqueue\Beanstalkd\Queue\BeanstalkdQueue' # or TYPO3\Jobqueue\Redis\Queue\RedisQueue, ...
<?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);
}
}
@bwaidelich
Copy link
Author

Usage:

 git clone git://git.typo3.org/Packages/TYPO3.Jobqueue.Common.git
 git clone git://git.typo3.org/Packages/TYPO3.Jobqueue.Beanstalkd.git
 composer require pda/pheanstalk

 ./flow job:list test
 ./flow job:work test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment