insidieux/task-bundle

Symfony task bundle

Installs: 18 353

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 1

Type:symfony-bundle

0.3.3 2022-01-11 19:01 UTC

This package is auto-updated.

Last update: 2024-04-11 23:52:39 UTC


README

Overview

The TaskBundle provides infrastructure for simple implementation of delayed tasks

Requirements

  • PHP 7.0 or greater
  • doctrine/orm: ^2.5
  • stof/doctrine-extensions-bundle: ^1.2
  • symfony/config: ^3.3
  • symfony/console: 3.3
  • symfony/dependency-injection: ^3.3
  • symfony/http-kernel: ^3.3
  • symfony/framework-bundle: ^3.3

Installation

You can install the package using the Composer package manager. You can install it by running this command in your project root:

composer require insidieux/task-bundle

Don't forget to make diff and run migrations, for creating tasks queue table

Usage

First of all, you need to add some new namespaces to separate task processing:

task:
  debug: true
  namespaces:
    - 'namespace1'
    - 'namespace2'

After building container, you'll see predefined worker services:

task.worker.namespace1
task.worker.namespace2

You can run them via cron/supervisor. Also you can scale them by passing worker-id to command

$ bin/console task:worker:namespace --id 1
$ bin/console task:worker:namespace --id 2

Create php class extending \TaskBundle\Handler\AbstractHandler and implement perform method Push created handler to queue

$this->getContainer()->get('task.services.pusher')->push(new SomeHandler, 'namespace1');

Roadmap

Changelog

This bundle changelog here

License

This bundle is released under the MIT license

Authors