josegonzalez/php-queuesadilla

Cannot push new queue items

tbelknapsgs opened this issue · 0 comments

Not sure what's going on, but I'm installing Queuesadilla according to the best interpretation of the instructions found here and I'm not able to push new items into my queue:
https://cakephp-queuesadilla.readthedocs.io/en/latest/installation.html

Here is my Queuesadilla.php file:

<?php

return [
    /**
     * Configures the Queuesadilla engine to read from mysql as it's database
     * The `url` parameter is a datasource name, as supported by CakePHP and other frameworks.
     *
     * Some examples:
     * - beanstalkd:  beanstalk://127.0.0.1:11300?queue=default&timeout=1
     * - in memory:   memory:///?queue=default&timeout=1
     * - mysql:       mysql://travis@127.0.0.1:3306/database_name?queue=default&timeout=1
     * - /dev/null:   null:///?queue=default&timeout=1
     * - redis:       redis://travis@127.0.0.1:6379/0?queue=default&timeout=1
     * - synchronous: synchronous:///?queue=default&timeout=1
     * - postgres:    pgsql://postgres@127.0.0.1:5432/database_name?queue=default
     */
    'Queuesadilla' => [
        'default' => [
            'pass' => env('QUEUESADILLA_DEFAULT_PASS', ''),
            'className' => 'josegonzalez\Queuesadilla\Engine\RedisEngine',
            'database' => null,
            'persistent' => true,
            'port' => 6379,
            'queue' => 'default',
            'host' => '127.0.0.1',
            'timeout' => 0,
        ],
        'estimates' => [
            'pass' => env('QUEUESADILLA_DEFAULT_PASS', ''),
            'className' => 'josegonzalez\Queuesadilla\Engine\RedisEngine',
            'database' => null,
            'persistent' => true,
            'port' => 6379,
            'queue' => 'estimates',
            'host' => '127.0.0.1',
            'timeout' => 0,
        ],
        'orders' => [
            'pass' => env('QUEUESADILLA_DEFAULT_PASS', ''),
            'className' => 'josegonzalez\Queuesadilla\Engine\RedisEngine',
            'database' => null,
            'persistent' => true,
            'port' => 6379,
            'queue' => 'orders',
            'host' => '127.0.0.1',
            'timeout' => 0,
        ],
        'messaging' => [
            'pass' => env('QUEUESADILLA_DEFAULT_PASS', ''),
            'className' => 'josegonzalez\Queuesadilla\Engine\RedisEngine',
            'database' => null,
            'persistent' => true,
            'port' => 6379,
            'queue' => 'messaging',
            'host' => '127.0.0.1',
            'timeout' => 0,
        ],
    ],
];

In my Application.php file:

        $this->addPlugin('Josegonzalez/CakeQueuesadilla');
        // Call parent to load bootstrap from files.
        parent::bootstrap();

In my bootstrap.php file, at the bottom:

Configure::load('Queuesadilla');
Queue::setConfig(Configure::consume('Queuesadilla'));

And finally, in my Controller, I'm trying to get the most basic message out:

    /**
     * View method
     *
     * @param string|null $id Estimate id.
     * @return \Cake\Http\Response|null|void Renders view
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
     */
    public function view($id = null)
    {
        $estimate = $this->Estimates->find('summary', ['estimate_id' => $id])->first();
        $this->Authorization->authorize($estimate);
        /*Queue::push('\Visualize\Controller\EstimatesController::doNothing', [
            'id' => 100,
        ], ['config' => 'estimates']);*/
        Queue::push('\Visualize\Controller\EstimatesController::doNothing');

        $this->set(compact('estimate'));
    }

You can see where a more complex attempt was commented out in favour of getting down to the basics. What I know so far:

  1. If I remove 'pass' element from the Queuesadilla config array, I get an error stating that I did not authenticate. So authentication is working fine.
  2. I do not get the error message "Redis class not found," so I'm certain PHP-Redis is installed and working.
  3. If I change queues by using 'queue' => 'someOtherQueue', I can see the queue being created, but it ends up being an empty array. This suggests that everything about Redis is operational, but there's something small I'm missing about your code.

Thank you for any advice and direction you may be able to provide! And thank you for all the amazing work for CakePHP that I get to take advantage of every day.