tempestphp / tempest-framework

The PHP framework that gets out of your way 🌊
https://tempestphp.com
MIT License
850 stars 60 forks source link

Async commands #314

Open brendt opened 2 months ago

brendt commented 2 months ago

We need a way to dispatch background jobs to a queue. We could make a CLI-only interface for starters. We already have a scheduler component which might come in handy, though still tbd.

Wulfheart commented 1 month ago

This is actually the one thing keeping me away from trying it out.

brendt commented 4 weeks ago

Gotcha! Thanks for that feedback, we might reprioritise stuff in the coming days :)

brendt commented 3 weeks ago

I made a rough sketch of what the system should look like:

image

innocenzi commented 3 weeks ago

Just thinking here, but I think something like Horizon should be built-in. Not talking about the interface (which I don't think is even necessary), but the functionality, with customizable environments and balancing strategies.

It's personally super rare that I don't need that and that I only use the built-in queue, so I think Tempest should also have that built-in.

aidan-casey commented 3 weeks ago

Hands down agree, @innocenzi. Long term, I'd really love to see Tempest play nicely with microservices/other languages in the queue as well. This is something that I firmly believe PHP to be lacking a good implementation of.

By way of update here, @brendt and I had this conversation a little bit and the starting point (for v1) may simply be async commands executed by a console runner that can then be rebuilt (under the hood) on top of a proper queue system post v1.

This is all pending Brent's post-weekend thoughts. 🙃

brendt commented 3 weeks ago

My mid-weekend thoughts are: for v1, we're going to add async support in the commandbus. There won't be any balancing strategies, but you will be able to push tasks to the background. I also don't think a UI is necessary, but there will be a CLI-based monitor.

After v1, we can expand on it as Aidan is describing