dev-feature/job-shareable-interfaces
dev-feature/job-shareable-interfacesQueue interop.
MIT
The Requires
- php >=7.0
by Tim Gunter
Queue interop.
This package provides abstraction and interfaces necessary for both job payloads and job processors to interact together., (*1)
All job payloads must implement the RunnableJobInterface
. A job processor will then call the following methods in order:, (*2)
RunnableJobInterface::setup()
RunnableJobInterface::run()
RunnableJobInterface::teardown()
Beside this, all open source Vanilla jobs must extend the AbstractJob
class so that jobs can be run directly on web server but also anywhere else by implementing a custom job processor., (*3)
Services are made accessible to job payloads. But in order to access them, a job must implement the proper aware
interface. By implementing the aware
interface, a job processor will inject the corresponding service thru a setter method prior to running the payload., (*4)
Here's the list of services available:, (*5)
A job can implement DatabaseAwareInterface
to get injected with the Garden\Db\Db object., (*6)
A job can implement VanillaContextAwareInterface
to get injected with the VanillaContextInterface
interface. br/
With VanillaContextInterface
, a job can access a ConfigInterface
to manage both configs and locales in Vanilla., (*7)
A job can implement SchedulerAwareInterface
to get injected with the SchedulerInterface
. With SchedulerInterface
, a job can also schedule other jobs from within its payload., (*8)
A job processor is responsible to provide implementation for the following interfaces:, (*9)
JobBridgeInterface
JobContextInterface
SchedulerInterface
VanillaContextInterface
ConfigInterface
It is also responsible to inject services to jobs that implements the following interfaces:, (*10)
DatabaseAwareInterface
SchedulerAwareInterface
VanillaContextAwareInterface
Queue interop.
MIT