Webador / SlmQueueBeanstalkd

Beanstalkd adapter for SlmQueue module
Other
10 stars 26 forks source link

Getting error while using it with zf2 #59

Closed iit2011081 closed 4 years ago

iit2011081 commented 7 years ago

In the controller I have created following things according to the document

protected $queue;

    public function __construct(QueueInterface $queue) {
        $this->queue = $queue;
    }

public function fooAction()
    {
        $job = new EmailJob;
        $job->setContent(array(
            'to'      => 'john@doe.com',
            'subject' => 'Just hi',
            'message' => 'Hi, I want to say hi!'
        ));
        $this->queue->push($job, ['delay' => 60]);
    }

In module.config.php I have define a route like this
'email' => array (
                    'type' => 'Zend\Mvc\Router\Http\Literal',
                    'options' => array (
                            'route' => '/email',
                            'defaults' => array (
                                    'controller' => 'Application\Controller\Index',
                                    'action' => 'foo'
                            )
                    ),
            ),

When I go to the url /email it is showing 500 error because the constructor is expecting one argument and I am not passing any argument. When I try to run following command php index.php queue beanstalkd default The result I am getting is

Zend Framework 2.3.3 application
Usage:

Reason for failure: Invalid arguments or no arguments provided