Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seams i cannot use $tries and $timeout properties on my queued listener class? #18199

Closed
peyobr opened this issue Mar 3, 2017 · 6 comments

Comments

@peyobr
Copy link

peyobr commented Mar 3, 2017

  • Laravel Version: 5.4.15
  • PHP Version: 7.0
  • Database Driver & Version: yajra/laravel-pdo-via-oci8
  • Queue Driver: Beanstalkd

Description:

It seams i cannot use $tries and $timeout properties on my queued listener class?

I'm doing something wrong?

Thank you.

peyobr

Steps To Reproduce:

@sisve
Copy link
Contributor

sisve commented Mar 4, 2017

We're missing steps to reproduce and an actual error description. Do you get an error message?

@peyobr
Copy link
Author

peyobr commented Mar 4, 2017

Hi, no error message. Simply:

  1. generate an event-listener pair
  2. add ShouldQueue interface on listener
  3. add $tries and $timeout properties on listener
  4. fire the event with the event() helper

Inspect queued listener using beanstalkd console and you'll notice that 'timeout' and 'maxTries' are stored as null.

If i use queued Job instead everything is ok!

Thanks.

@sisve
Copy link
Contributor

sisve commented Mar 4, 2017

I see nothing in the code that states that events should support $tries or $timeout. Reference:

protected function callQueueMethodOnHandler($class, $method, $arguments)
{
$handler = (new ReflectionClass($class))->newInstanceWithoutConstructor();
$handler->queue($this->resolveQueue(), 'Illuminate\Events\CallQueuedHandler@call', [
'class' => $class, 'method' => $method, 'data' => serialize($arguments),
]);
}
/**
* Queue the handler class.
*
* @param string $class
* @param string $method
* @param array $arguments
* @return void
*/
protected function queueHandler($class, $method, $arguments)
{
$listener = (new ReflectionClass($class))->newInstanceWithoutConstructor();
$connection = isset($listener->connection) ? $listener->connection : null;
$queue = isset($listener->queue) ? $listener->queue : null;
$this->resolveQueue()
->connection($connection)
->pushOn($queue, new CallQueuedListener($class, $method, $arguments));
}

Are you saying that something in the docs says they should; or are you asking for a new feature?

@peyobr
Copy link
Author

peyobr commented Mar 4, 2017

You are right. I have assumed that new granular approach would be available in listener too.

I hope this will be in the near future!

Thank you!

@themsaid
Copy link
Member

Just submitted a PR that should add the functionality #18375

@peyobr
Copy link
Author

peyobr commented Mar 16, 2017

Thank you 1K!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants