{"id":14984074,"url":"https://github.com/sulu/messenger","last_synced_at":"2026-02-10T12:01:38.110Z","repository":{"id":57061275,"uuid":"468018124","full_name":"sulu/messenger","owner":"sulu","description":"A symfony message bus with additional middleware used by Sulu CMS.","archived":false,"fork":false,"pushed_at":"2025-03-11T07:32:40.000Z","size":39,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-24T17:21:39.278Z","etag":null,"topics":["commandbus","messagebus","messenger","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","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/sulu.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-03-09T17:00:51.000Z","updated_at":"2025-02-02T09:21:52.000Z","dependencies_parsed_at":"2023-11-30T10:25:55.742Z","dependency_job_id":"9526e0b4-482e-47f9-8666-ca216a4b954d","html_url":"https://github.com/sulu/messenger","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"6991f4c75f231717ae95b4ef4a9a6c2e2fa6172b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulu%2Fmessenger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulu%2Fmessenger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulu%2Fmessenger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulu%2Fmessenger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sulu","download_url":"https://codeload.github.com/sulu/messenger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281424,"owners_count":21077423,"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":["commandbus","messagebus","messenger","symfony","symfony-bundle"],"created_at":"2024-09-24T14:08:24.605Z","updated_at":"2026-02-10T12:01:38.102Z","avatar_url":"https://github.com/sulu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSulu Messenger\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://sulu.io/\" target=\"_blank\"\u003e\n        \u003cimg width=\"30%\" src=\"https://sulu.io/uploads/media/800x/00/230-Official%20Bundle%20Seal.svg?v=2-6\u0026inline=1\" alt=\"Official Sulu Bundle Badge\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"LICENSE\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/sulu/messenger.svg\" alt=\"GitHub license\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/sulu/messenger/releases\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/tag/sulu/messenger.svg\" alt=\"GitHub tag (latest SemVer)\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/sulu/messenger/actions\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/sulu/messenger/test-application.yaml\" alt=\"Test workflow status\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/sulu/sulu/releases\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/sulu%20compatibility-%3E=2.0-52b6ca.svg\" alt=\"Sulu compatibility\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\nThis library provides the stamps and middlewares which configures the Sulu message bus.\nIt can be used independently in any Symfony installation.\n\n## Installation\n\nMake sure Composer is installed globally, as explained in the\n[installation chapter](https://getcomposer.org/doc/00-intro.md)\nof the Composer documentation.\n\nOpen a command console, enter your project directory and execute:\n\n```bash\ncomposer require sulu/messenger\n```\n\nThen, enable the bundle by adding it to the list of registered bundles\nin the `config/bundles.php` file of your project:\n\n```php\n// config/bundles.php\n\nreturn [\n    // ...\n    Sulu\\Messenger\\Infrastructure\\Symfony\\HttpKernel\\SuluMessengerBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n## Middlewares\n\n### UnpackExceptionMiddleware\n\nThe `UnpackExceptionMiddleware` will unpack the `HandlerFailedException` which\nis created by the Symfony [`HandleMessageMiddleware`](https://github.com/symfony/symfony/blob/c7dbcc954366f92f66360f3960a10dc1ef5f2584/src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php#L129).\nThis way we make sure that the real exception is thrown out by this message\nbus, and a controller can catch or convert it to a specific http status code.\nThis middleware is always activated in the Sulu message bus.\n\n### LockMiddleware\n\nThe `LockMiddleware` will allow to lock specific resources by a given key. This is commonly\nused to prevent concurrent access to the same resource and avoid race conditions.\nThe locking can be activated and controlled via the `LockStamp` which supports the same parameters\nas the Symfony `LockFactory` to create the Lock.\n\n```php\nuse Sulu\\Messenger\\Infrastructure\\Symfony\\Messenger\\LockMiddleware\\LockStamp;\n\n$this-\u003ehandle(new Envelope(new YourMessage(), [new LockStamp('lock-key')]));\n\n# set ttl and autorelease\n$this-\u003ehandle(new Envelope(new YourMessage(), [new LockStamp('lock-key', 300.0, true)]));\n\n# multiple locks possible all locks need to be acquired before processing the message\n$this-\u003ehandle(new Envelope(new YourMessage(), [new LockStamp('lock-key-1'), new LockStamp('lock-key-2')]));\n```\n\nThis middleware is always activated in the Sulu message bus.\n\n### DoctrineFlushMiddleware\n\nThe `DoctrineFlushMiddleware` is a Middleware which let us flush the Doctrine\nEntityManager by an opt-in flag via the `EnableFlushStamp`. It can be used this way:\n\n```php\nuse Sulu\\Messenger\\Infrastructure\\Symfony\\Messenger\\FlushMiddleware\\EnableFlushStamp;\n\n$this-\u003ehandle(new Envelope(new YourMessage(), [new EnableFlushStamp()]));\n```\n\nThis middleware is always activated in the Sulu message bus.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulu%2Fmessenger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsulu%2Fmessenger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulu%2Fmessenger/lists"}