Giter VIP home page Giter VIP logo

cron-job's Introduction

Cron Job

This library is used to manage and process cron jobs from the database.

The cron are sent to a queue and processed by a worker via symfony messenger.

Configuration

The package can be enabled as follows:

NOTE: Below are the default configs which can be overwritten by your needs.

Framework extra

draw_framework_extra:
  # ...
  cron_job:
    enabled: true
    doctrine:
      orm:
        mappings:
          DrawCronJob:
            is_bundle: false
            type: attribute
            dir: ...
            prefix: Draw\Component\CronJob\Entity

NOTE: The following services are available:

  • draw.cron_job.command.queue_cron_job_by_name_command: Draw\Component\CronJob\Command\QueueCronJobByNameCommand
  • draw.cron_job.command.queue_due_cron_jobs_command: Draw\Component\CronJob\Command\QueueDueCronJobsCommand
  • draw.cron_job.cron_job_processor: Draw\Component\CronJob\CronJobProcessor
  • draw.cron_job.message_handler.execute_cron_job_message_handler: Draw\Component\CronJob\MessageHandler\ExecuteCronJobMessageHandler

Sonata integration

draw_sonata_integration:
  cron_job:
    enabled: true
    admin:
      cron_job:
        group: Cron Job
        entity_class: Draw\Component\CronJob\Entity\CronJob
        controller_class: Draw\Bundle\SonataIntegrationBundle\CronJob\Controller\CronJobController
        icon: fas fa-clock
        label: Cron Job
        pager_type: simple
        show_in_dashboard: true
        translation_domain: SonataAdminBundle
      cron_job_execution:
        group: Cron Job
        entity_class: Draw\Component\CronJob\Entity\CronJobExecution
        controller_class: Draw\Bundle\SonataIntegrationBundle\CronJob\Controller\CronJobExecutionController
        icon: null
        label: Cron Job Execution
        pager_type: simple
        show_in_dashboard: true
        translation_domain: SonataAdminBundle

Messenger

You need to configure the routing for the messenger component for the message that will be used to process the cron jobs.

framework:
  messenger:
    routing:
      Draw\Component\CronJob\Message\ExecuteCronJobMessage: 'async'

Usage

Once the package is enabled, a new admin page will be available - Cron Job. The package also provides 2 console commands:

  • draw:cron-job:queue-due - it is used to process due cron jobs by their configs; it should be configured as a cron to be executed with * * * * *
  • draw:cron-job:queue-by-name - it allows to manually process a cron job by its name passed as an argument

cron-job's People

Contributors

mpoiriert avatar dumitracheadrian avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.