aoepeople/aoe_queue

Generic queue based on Zend_Queue

Installs: 9 985

Dependents: 0

Suggesters: 0

Security: 0

Stars: 35

Watchers: 48

Forks: 11

Open Issues: 2

Type:magento-module

dev-master 2015-09-28 22:44 UTC

This package is not auto-updated.

Last update: 2024-12-19 15:45:38 UTC


README

How to run unit tests

cd <MagentoDocRoot>

# Get phpunit
wget http://pear.phpunit.de/get/phpunit.phar
chmod +x phpunit.phar

# Run tests
./phpunit.phar tests/Aoe_Queue/QueueTestcase.php

Adding a task to the queue

$queue = Mage::getModel('aoe_queue/queue'); /* @var $queue Aoe_Queue_Model_Queue */
$queue->addTask('aoe_queue/dummy::test', array('-+', '5'));

Processing the queue

$queue = Mage::getModel('aoe_queue/queue'); /* @var $queue Aoe_Queue_Model_Queue */
$messages = $queue->receive(5); /* @var $messages Zend_Queue_Message_Iterator */
foreach ($messages as $message) { /* @var $message Aoe_Queue_Model_Message */
    $message->execute();
}

Cron configuration

In System > Configuration > Advanced > System > Queue

Use Aoe_Scheduler to run a separate cronjob to process the aoe_queue task so this won't block the other tasks.