wp-background-processing
wp-background-processing copied to clipboard
Consider using queue interprop as abstraction for queues
Hello!
Please look at https://github.com/queue-interop/queue-interop project. Using interfaces from it allows us reuse some implementations like enqueue, which supports a lot of transports. You can outsource some code
Thinking about this, what do you think the minimum viable implementation would be?
Do you mean just to split WP_Background_Process
into few classes, each implementing one of these:
- a
Queue
to store the queued items in the db - a
Producer
to be able to add items to the queue - a
Consumer
to be able to retrieve and process those items
Are there any other interfaces needed?
Or do you mean WP_Background_Process
would become a Context
implementation and the dev working with WP_Background_Process
would become responsible to create suitable Queues
, Producers
and Consumers
(probably providing some defaults or in case of the Consumer
an abstract class, where the actual processing can be defined in a child just like right now the WP_Background_Process::task()
abstract method).
How could the project make sure that it continues to work in a standalone way as well, when there is no MQ implementation available for the WP site?
Could you please elaborate a bit on your ideal design for this idea?
Closing ancient issue. :smile: