{"id":21341442,"url":"https://github.com/avto-dev/amqp-rabbit-laravel-queue","last_synced_at":"2025-07-12T14:34:17.325Z","repository":{"id":39381103,"uuid":"187487185","full_name":"avto-dev/amqp-rabbit-laravel-queue","owner":"avto-dev","description":"RabbitMQ (amqp-ext based) laravel queue driver","archived":false,"fork":false,"pushed_at":"2024-04-26T10:15:33.000Z","size":151,"stargazers_count":8,"open_issues_count":1,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T11:28:03.301Z","etag":null,"topics":["amqp","driver","laravel","queue","rabbit"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avto-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2019-05-19T14:28:05.000Z","updated_at":"2024-04-26T11:28:07.565Z","dependencies_parsed_at":"2023-11-07T07:29:12.332Z","dependency_job_id":"c5c3af2d-f51c-420b-b8ae-c8501ce12b34","html_url":"https://github.com/avto-dev/amqp-rabbit-laravel-queue","commit_stats":{"total_commits":39,"total_committers":8,"mean_commits":4.875,"dds":0.641025641025641,"last_synced_commit":"ba93b0a790eb74c3ca2ce5aa60927e9b1bd7be6f"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Famqp-rabbit-laravel-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Famqp-rabbit-laravel-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Famqp-rabbit-laravel-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Famqp-rabbit-laravel-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avto-dev","download_url":"https://codeload.github.com/avto-dev/amqp-rabbit-laravel-queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225824750,"owners_count":17529906,"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":["amqp","driver","laravel","queue","rabbit"],"created_at":"2024-11-22T00:56:52.820Z","updated_at":"2025-07-12T14:34:17.318Z","avatar_url":"https://github.com/avto-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://laravel.com/assets/img/components/logo-laravel.svg\" alt=\"Laravel\" width=\"240\" /\u003e\n\u003c/p\u003e\n\n# RabbitMQ-based Laravel queue driver\n\n[![Version][badge_packagist_version]][link_packagist]\n[![PHP Version][badge_php_version]][link_packagist]\n[![Build Status][badge_build_status]][link_build_status]\n[![Coverage][badge_coverage]][link_coverage]\n[![Downloads count][badge_downloads_count]][link_packagist]\n[![License][badge_license]][link_license]\n\nThis package allows to use RabbitMQ queues for queued Laravel (prioritized) jobs. Fully configurable.\n\nInstalled php extension `ext-amqp` is required. Installation steps can be found in [Dockerfile](./Dockerfile).\n\nFor jobs delaying you also should install [`rabbitmq-delayed-message-exchange`][link_rabbitmq_delayed_message_exchange] plugin for RabbitMQ. Delaying is optional feature.\n\n## Install\n\n\u003e **Important:** Before using this package you should install [`avto-dev/amqp-rabbit-manager`][link_amqp_rabbit_manager] into your application. Installation steps can be found [here][link_amqp_rabbit_manager_install].\n\nRequire this package with composer using the following command:\n\n```shell\n$ composer require avto-dev/amqp-rabbit-laravel-queue \"^2.0\"\n```\n\n\u003e Installed `composer` is required ([how to install composer][getcomposer]). Also you need to fix the major version of package.\n\n\u003e You need to fix the major version of package.\n\nAfter that you should modify your configuration files:\n\n### `./config/rabbitmq.php`\n\nRabbitMQ queues and exchanges configuration:\n\n```php\n\u003c?php\n\nuse Interop\\Amqp\\AmqpQueue;\nuse Interop\\Amqp\\AmqpTopic;\n\nreturn [\n\n    // ...\n\n    'queues' =\u003e [\n\n        'jobs' =\u003e [\n            'name'         =\u003e env('JOBS_QUEUE_NAME', 'jobs'),\n            'flags'        =\u003e AmqpQueue::FLAG_DURABLE, // Remain queue active when a server restarts\n            'arguments'    =\u003e [\n                'x-max-priority' =\u003e 255, // @link \u003chttps://www.rabbitmq.com/priority.html\u003e\n            ],\n            'consumer_tag' =\u003e null,\n        ],\n\n        'failed' =\u003e [\n            'name'         =\u003e env('FAILED_JOBS_QUEUE_NAME', 'failed-jobs'),\n            'flags'        =\u003e AmqpQueue::FLAG_DURABLE,\n            'arguments'    =\u003e [\n                'x-message-ttl' =\u003e 604800000, // 7 days, @link \u003chttps://www.rabbitmq.com/ttl.html\u003e\n                'x-queue-mode'  =\u003e 'lazy', // @link \u003chttps://www.rabbitmq.com/lazy-queues.html\u003e\n            ],\n            'consumer_tag' =\u003e null,\n        ],\n\n    ],\n\n    // ...\n\n    'exchanges' =\u003e [\n\n        // RabbitMQ Delayed Message Plugin is required (@link: \u003chttps://git.io/fj4SE\u003e)\n        'delayed-jobs' =\u003e [\n            'name'      =\u003e env('DELAYED_JOBS_EXCHANGE_NAME', 'jobs.delayed'),\n            'type'      =\u003e 'x-delayed-message',\n            'flags'     =\u003e AmqpTopic::FLAG_DURABLE, // Remain active when a server restarts\n            'arguments' =\u003e [\n                'x-delayed-type' =\u003e AmqpTopic::TYPE_DIRECT,\n            ],\n        ],\n\n    ],\n\n    // ...\n\n    'setup' =\u003e [\n        'rabbit-default' =\u003e [\n            'queues' =\u003e [\n                'jobs',\n                'failed',\n            ],\n            'exchanges' =\u003e [\n                'delayed-jobs'\n            ],\n        ],\n    ],\n];\n```\n\n### `./config/queue.php`\n\nLaravel queue settings:\n\n```php\n\u003c?php\n\nuse AvtoDev\\AmqpRabbitLaravelQueue\\Connector;\n\nreturn [\n\n    // ...\n\n    'default' =\u003e env('QUEUE_DRIVER', 'rabbitmq'),\n\n    // ...\n\n    'connections' =\u003e [\n\n        // ...\n\n        'rabbitmq' =\u003e [\n            'driver'              =\u003e Connector::NAME,\n            'connection'          =\u003e 'rabbit-default',\n            'queue_id'            =\u003e 'jobs',\n            'delayed_exchange_id' =\u003e 'delayed-jobs',\n            'timeout'             =\u003e (int) env('QUEUE_TIMEOUT', 0), // The timeout is in milliseconds\n            'resume'              =\u003e (bool) env('QUEUE_RESUME', false), // Resume consuming when timeout is over\n        ],\n    ],\n\n    // ...\n\n    'failed' =\u003e [\n        'connection' =\u003e 'rabbit-default',\n        'queue_id'   =\u003e 'failed',\n    ],\n];\n```\n\n\u003e `resume` can be used with non-zero `timeout` value for periodic connection reloading _(for example, if you set `'timeout' =\u003e 30000` and `'resume' =\u003e true`, queue worker will unsubscribe and subscribe back to the queue every 30 seconds **without** process exiting)_.\n\nYou can remove `delayed_exchange_id` for disabling delayed jobs feature.\n\nAt the end, don't forget to execute command `php ./artisan rabbit:setup`.\n\n### How jobs delaying works?\n\nVery simple:\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/avto-dev/amqp-rabbit-laravel-queue/.github/queue-delay.svg\" width=\"100%\" alt=\"\" /\u003e\n\u003c/div\u003e\n\n## Usage\n\nYou can dispatch your jobs as usual (`dispatch(new Job)` or `dispatch(new Job)-\u003edelay(10)`), commands like `queue:work`, `queue:failed`, `queue:retry` and others works fine.\n\n#### Additional features:\n\n- Jobs delaying (plugin `rabbitmq_delayed_message_exchange` for RabbitMQ server is required);\n- Jobs priority (job should implements `PrioritizedJobInterface` interface);\n- Automatically delayed messages exchanges bindings (only if you use command `rabbit:setup` for queues and exchanges creation);\n- The ability to store the state of `job`\n\n#### State storing\n\nUsing this package you can store any variables (except resources and callable entities) between job restarts (just use trait `WithJobStateTrait` in your job class). But you should remember - state is available only inside job `handle` method.\n\n#### Consumer custom tag prefix\n\nEvery consumer has an identifier that is used by client libraries to determine what handler to invoke for a given delivery. Their names vary from protocol to protocol. Consumer tags and subscription IDs are two most commonly used terms.\n\nIf you want to add custom prefix to the consumer tag, you can specify it with an additional argument in the `AvtoDev\\AmqpRabbitLaravelQueue\\Worker::__construct` method.\n\n### :warning: Warning\n\n**Be careful with commands `queue:failed` and `queue:retry`**. If during command execution something happens (lost connection, etc) you may loose all failed jobs!\n\nYou should avoid to use next method _(broker does not guarantee operations order, so calling results may be wrong)_:\n\n- `\\AvtoDev\\AmqpRabbitLaravelQueue\\Queue::size()`\n- `\\AvtoDev\\AmqpRabbitLaravelQueue\\Failed\\RabbitQueueFailedJobProvider::count()`\n\n### Testing\n\nFor package testing we use `phpunit` framework and `docker` with `compose` plugin as develop environment. So, just write into your terminal after repository cloning:\n\n```shell\n$ make build\n$ make latest # or 'make lowest'\n$ make test\n```\n\n## Changes log\n\n[![Release date][badge_release_date]][link_releases]\n[![Commits since latest release][badge_commits_since_release]][link_commits]\n\nChanges log can be [found here][link_changes_log].\n\n## Support\n\n[![Issues][badge_issues]][link_issues]\n[![Issues][badge_pulls]][link_pulls]\n\nIf you will find any package errors, please, [make an issue][link_create_issue] in current repository.\n\n## License\n\nThis is open-sourced software licensed under the [MIT License][link_license].\n\n[badge_packagist_version]:https://img.shields.io/packagist/v/avto-dev/amqp-rabbit-laravel-queue.svg?maxAge=180\n[badge_php_version]:https://img.shields.io/packagist/php-v/avto-dev/amqp-rabbit-laravel-queue.svg?longCache=true\n[badge_build_status]:https://img.shields.io/github/actions/workflow/status/avto-dev/amqp-rabbit-laravel-queue/tests.yml\n[badge_coverage]:https://img.shields.io/codecov/c/github/avto-dev/amqp-rabbit-laravel-queue/master.svg?maxAge=60\n[badge_downloads_count]:https://img.shields.io/packagist/dt/avto-dev/amqp-rabbit-laravel-queue.svg?maxAge=180\n[badge_license]:https://img.shields.io/packagist/l/avto-dev/amqp-rabbit-laravel-queue.svg?longCache=true\n[badge_release_date]:https://img.shields.io/github/release-date/avto-dev/amqp-rabbit-laravel-queue.svg?style=flat-square\u0026maxAge=180\n[badge_commits_since_release]:https://img.shields.io/github/commits-since/avto-dev/amqp-rabbit-laravel-queue/latest.svg?style=flat-square\u0026maxAge=180\n[badge_issues]:https://img.shields.io/github/issues/avto-dev/amqp-rabbit-laravel-queue.svg?style=flat-square\u0026maxAge=180\n[badge_pulls]:https://img.shields.io/github/issues-pr/avto-dev/amqp-rabbit-laravel-queue.svg?style=flat-square\u0026maxAge=180\n[link_releases]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/releases\n[link_packagist]:https://packagist.org/packages/avto-dev/amqp-rabbit-laravel-queue\n[link_build_status]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/actions\n[link_coverage]:https://codecov.io/gh/avto-dev/amqp-rabbit-laravel-queue/\n[link_changes_log]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/blob/master/CHANGELOG.md\n[link_issues]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/issues\n[link_create_issue]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/issues/new/choose\n[link_commits]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/commits\n[link_pulls]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/pulls\n[link_license]:https://github.com/avto-dev/amqp-rabbit-laravel-queue/blob/master/LICENSE\n[getcomposer]:https://getcomposer.org/download/\n[link_amqp_rabbit_manager]:https://github.com/avto-dev/amqp-rabbit-manager\n[link_amqp_rabbit_manager_install]:https://github.com/avto-dev/amqp-rabbit-manager/blob/master/README.md#install\n[link_rabbitmq_delayed_message_exchange]:https://github.com/rabbitmq/rabbitmq-delayed-message-exchange\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favto-dev%2Famqp-rabbit-laravel-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favto-dev%2Famqp-rabbit-laravel-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favto-dev%2Famqp-rabbit-laravel-queue/lists"}