Skip to content

Container::when does not work for handling Jobs. #23602

@frankdejonge

Description

@frankdejonge
  • Laravel Version: 5.6.12
  • PHP Version: 7.2.1
  • Database Driver & Version: Not relevant

Description:

I want to contextually bind a service to the handle method of a Job. When

Steps To Reproduce:

  1. Have a Job that takes a service defined as an interface.
  2. Bind a service contextually to the job.
$this->app->when(Job::class)->needs(Contract::class)->give(function () { return Concrete(); });

Result

The queue worker endlessly tries to process the message, failing and then retrying. It was not easy to determine this was the problem either. When wiring cannot be resovled I don't expect it to be handled the same way "failed job processing" is handled.

screen shot 2018-03-18 at 15 30 11

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions