Skip to content

gallyamow/job-queue

Repository files navigation

Job-queue

Usage

$job = Job::initNew(
    Uuid::uuid4()->toString(),
    ExampleReverseGeocodeCommand::fromLonLat(0.5, 0.5),
    new \DateTimeImmutable()
);

$jobManager = new JobManager();
$jobManager->enqueueJob($job);

Requirements

Wishes

  • composer package
  • VueJs UI

TODO

  • re-run jobs due deployment stuffs (for example after compatibility-breaking modifications of some JobCommand)
  • several implementations of JobCommandFactoryInterface
  • more plain command (JobCommandInterface is overweight)

Solution

  • Bus - symfony/messenger bus
  • Job - stored in DB (ORM) entity
  • JobCommand - DTO that represents Job and will be used for transferring over Bus
  • JobManager - service that will be used for enqueue Jobs or chain of Jobs

Configuration

https://davegebler.com/post/php/how-to-create-a-symfony-5-bundle

# config/packages/messenger.yaml
framework:
  messenger:
    buses:
      messenger.bus.default:
        middleware:
          - @core-extensions.job_queue.job_middleware

## ????
job_queue:
  jobs_table: "orm_jobs"

Shell command to run consumer:

ExecStart=php bin/console messenger:consume async --time-limit=3600 --id=worker_1

About

Simple job-queue.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages