User:JGiannelos (WMF)/Notes/JobQueue-dev-env


 * Running background tasks on mediawiki is handled via JobQueue
 * JobQueue has various implementations
 * Simple JobQueue
 * DB based
 * Doesn't implement delayed events
 * Default in most MW development environments
 * Redis JobQueue
 * Redis based
 * Allows delayed events
 * Needs redis based jobrunner to work (mediawiki/services/jobrunner)
 * EventBus JobQueue
 * Based on EventBus extension
 * Exposes HTTP API endpoint that you can submit jobs


 * For working with delayed events the simplest way is to setup redis and redis based runners
 * docker-compose + redis
 * docker-compose + redis job runner


 * Working with jobs (php)
 * Manual:Job_queue/For_developers
 * tl;dr
 * Implement a Job class
 * Create a job instance
 * Submit the job: JobQueueGroup::singleton->push( $job )


 * For delayed jobs
 * When building the job pass the `jobReleaseTimestamp` parameter in the constructor's params
 * This is a unix timestamp of when (roughly) the job is going to be executed
 * Important -> your dev env setup should us a JobQueue implementation that supports delayed jobs