{"id":17705108,"url":"https://github.com/sfcod/jobqueue","last_synced_at":"2025-08-20T23:32:25.447Z","repository":{"id":45492936,"uuid":"122215681","full_name":"sfcod/jobqueue","owner":"sfcod","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-16T20:08:40.000Z","size":132,"stargazers_count":15,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-10T04:10:24.637Z","etag":null,"topics":["async-queue","php","queue","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sfcod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-20T15:21:34.000Z","updated_at":"2024-09-16T20:08:43.000Z","dependencies_parsed_at":"2024-10-25T01:12:44.347Z","dependency_job_id":"04d2600e-48cd-4468-a4c7-bce942ec8716","html_url":"https://github.com/sfcod/jobqueue","commit_stats":{"total_commits":79,"total_committers":4,"mean_commits":19.75,"dds":0.3924050632911392,"last_synced_commit":"1537a85e23cbb5ea4f7d1d5a61b0132241a62fd0"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfcod%2Fjobqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfcod%2Fjobqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfcod%2Fjobqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sfcod%2Fjobqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sfcod","download_url":"https://codeload.github.com/sfcod/jobqueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230471175,"owners_count":18231193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-queue","php","queue","symfony","symfony-bundle"],"created_at":"2024-10-24T22:06:28.463Z","updated_at":"2024-12-19T17:08:20.175Z","avatar_url":"https://github.com/sfcod.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Job Queue Bundle for Symfony\n======================================================\n\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sfcod/jobqueue/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sfcod/jobqueue/?branch=master)[![Code Climate](https://codeclimate.com/github/sfcod/jobqueue/badges/gpa.svg)](https://codeclimate.com/github/sfcod/jobqueue)\n\nProvides async queues implementation for Symfony (using mongodb as main storage).\n\n#### Supported drivers (storages):\n- [MongoDB](Doc/mongodb.md)\n- [Redis](Doc/redis.md)\n- [Custom](Doc/custom.md)\n\n#### Config:\nRegister the bundle config and all available \"Jobs\"\n```yaml\nsfcod_queue:\n    drivers:\n        redis: 'SfCod\\QueueBundle\\Connector\\RedisConnector'\n    connections:\n        default: { driver: 'redis', collection: 'queue_jobs', queue: 'default', expire: 360, limit: 2 }  \n\nservices:\n#    _instanceof:\n#        SfCod\\QueueBundle\\Base\\JobInterface:\n#            tags: ['sfcod.jobqueue.job']\n    App\\Job\\:\n        resource: '../src/Job/*'\n        tags: ['sfcod.jobqueue.job']\n```\n\n#### Adding jobs to the queue:\n\nCreate your own \"job\" which implements SfCod\\QueueBundle\\Base\\JobInterface and run it: \n\n```php\npublic function someFunc(JobQueue $jobQueue) {\n    $data = [...];\n    $jobQueue-\u003epush(YourJob::class, $data);\n}\n```\nwhere $data is a payload for your job\n\n#### Commands:\n\nRun worker daemon with console command: \n```php\n$ php bin/console job-queue:work\n$ php bin/console job-queue:retry --id=\u003cJob ID\u003e\n$ php bin/console job-queue:run-job \u003cJob ID\u003e\n```\n\nWhere: \n- work - command to run daemon in loop;\n- retry - command to move all failed jobs back into queue, can be used with --id param to retry only single job\n- run-job - command to run single job by id\n\n#### Available events:\n```php\n'job_queue_worker.raise_before_job': SfCod\\QueueBundle\\Event\\JobProcessingEvent;\n'job_queue_worker.raise_after_job': SfCod\\QueueBundle\\Event\\JobProcessedEvent;\n'job_queue_worker.raise_exception_occurred_job': SfCod\\QueueBundle\\Event\\JobExceptionOccurredEvent;\n'job_queue_worker.raise_failed_job': SfCod\\QueueBundle\\Event\\JobFailedEvent;\n'job_queue_worker.stop': SfCod\\QueueBundle\\Event\\WorkerStoppingEvent;\n```\n\n#### Configurable services list (with default parameters):\n\n##### JobQueue:\n```yaml\nSfCod\\QueueBundle\\Service\\JobQueue:\n    public: true\n    arguments:\n        - '@SfCod\\QueueBundle\\Service\\QueueManager'\n```\nSfCod\\QueueBundle\\Service\\JobQueue: main job queue service\n\n##### Worker\n```yaml\nSfCod\\QueueBundle\\Worker\\Worker:\n    arguments:\n        - '@SfCod\\QueueBundle\\Service\\QueueManager'\n        - '@SfCod\\QueueBundle\\Service\\JobProcess'\n        - '@SfCod\\QueueBundle\\Failer\\FailedJobProviderInterface'\n        - '@SfCod\\QueueBundle\\Handler\\ExceptionHandlerInterface'\n        - '@Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'\n```\nSfCod\\QueueBundle\\Worker\\Worker: async worker for \"work\" command\n\n##### JobProcess\n```yaml\nSfCod\\QueueBundle\\Service\\JobProcess:\n    arguments:\n        - 'console'\n        - '%kernel.project_dir%/bin'\n        - 'php'\n        - ''\n``` \nJobProcess: default config for jobs command processor in async queues, where:\n- 'console' - name of console command \n- '%kernel.project_dir%/bin' - path for console command\n- 'php' - binary script\n- '' - binary script arguments\n\n##### Connector\n```yaml\nSfCod\\QueueBundle\\Connector\\ConnectorInterface:\n    class: SfCod\\QueueBundle\\Connector\\RedisConnector\n    arguments:\n        - '@SfCod\\QueueBundle\\Base\\JobResolverInterface'\n        - '@SfCod\\QueueBundle\\Base\\RedisDriver'\n```\nSfCod\\QueueBundle\\Connector\\ConnectorInterface: connector for queues' database\n\n##### Failer\n```yaml\nSfCod\\QueueBundle\\Failer\\FailedJobProviderInterface:\n    class: SfCod\\QueueBundle\\Failer\\RedisFailedJobProvider\n    arguments:\n        - '@SfCod\\QueueBundle\\Service\\RedisDriver'\n        - 'queue_jobs_failed'\n```\nSfCod\\QueueBundle\\Failer\\FailedJobProviderInterface: storage for failed jobs\n\n##### Job resolver\n```yaml\nSfCod\\QueueBundle\\Base\\JobResolverInterface:\n    class: SfCod\\QueueBundle\\Service\\JobResolver\n    arguments:\n        - '@Symfony\\Component\\DependencyInjection\\ContainerInterface'\n```\nSfCod\\QueueBundle\\Base\\JobResolverInterface: resolver for jobs, it builds job using job's display name, for default jobs fetches from container as a public services.\n\n##### Exception handler\n```yaml\nSfCod\\QueueBundle\\Handler\\ExceptionHandlerInterface:\n    class: SfCod\\QueueBundle\\Handler\\ExceptionHandler\n    arguments:\n        - '@Psr\\Log\\LoggerInterface'\n```\nSfCod\\QueueBundle\\Handler\\ExceptionHandlerInterface: main exception handler, used for logging issues\n\n##### Testing:\nYou can run tests using prepared configuration xml file:\n```php\nphp bin/phpunit --configuration ./vendor/sfcod/jobqueue/phpunit.xml.dist --bootstrap ./vendor/autoload.php\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfcod%2Fjobqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsfcod%2Fjobqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsfcod%2Fjobqueue/lists"}