Question about benstalkd queue

I want to add two phase authentication in my website login process, thus I want to send an SMS to my user with random access code, benstalkd can help to asynchronous send the message, and improvement user experience. And you can easy to see, this is a time sensitive process, so it cannot be added into crontab, I want my send process can be notified when a new job put into the queue.

Any idea? Thanks in advanced.


$di->set('queue', function() use ($config) {
    $queue = new Phalcon\Queue\Beanstalk(array(
        'host' => $config->queue->host,
        'port' => $config->queue->port

    return $queue;


register a callback function or observer? how?


How about:

!/usr/local/bin/php -q

<?php // Stop the script giving time out errors.. set_time_limit(0);

// Main loop while(true) { $queue = new Phalcon\Queue\Beanstalk(array( 'host' => '', 'port' => 11300 )); while (($job = $this->queue->peekReady()) !== false) { $job = $this->queue->reserve(); $message = $job->getBody();