[13.x] Allow Jobs to include context#60243
Open
jackbayliss wants to merge 2 commits into
Open
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
392f281 to
5b99c8c
Compare
Update Job.php this would be useful Update RedisQueueTest.php lil test improvements no empty array... cs oop created should be last tbf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Happy bday week!
When inspecting queued jobs or handling job events, you often just want a bit more context , especially during deployments. This is different from global "world"
illuminate:log:contextand more about the job context itself the job doesn't have to run for us to have this context just be dispatched.I made a video to also cover this... (audio on, bit boring)
Screen.Recording.2026-05-26.at.12.53.59.mov
This PR adds a
HasContextinterface, which adds context into the job payload, implement it on your job and return whatever is useful:Then when inspecting the queue we can access it:
Or in a listener access the context we need... no need to dig in the payload
The context is completely controlled in userland, and completely opt in.
Used an interface cause I can't think of a nicer non b/c way , perhaps in 14.x we could method_exists if you don't like it, but I thought it was ok for now.
This is my eyes would also be very cool to surface to monitoring services too such as Telescope, etc.
This means we can go logging from reservedJobs from:
To
Specific to the job, and all contained within that job...
Any adjustments, have at it, or let me know where to tweak ... happy to rename too maybe metadata is more fitting?