{"id":14063335,"url":"https://github.com/petitpress/gps-messenger-bundle","last_synced_at":"2025-04-09T20:42:22.963Z","repository":{"id":44171393,"uuid":"312022688","full_name":"petitpress/gps-messenger-bundle","owner":"petitpress","description":"The bundle provides a simple implementation of Google Pub/Sub transport for Symfony Messenger.","archived":false,"fork":false,"pushed_at":"2024-05-23T09:14:05.000Z","size":91,"stargazers_count":17,"open_issues_count":9,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-23T09:51:33.628Z","etag":null,"topics":["google","google-cloud-pubsub","google-cloud-sdk","message-queue","symfony","symfony-bundle","symfony-messenger"],"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/petitpress.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":"2020-11-11T16:12:06.000Z","updated_at":"2024-06-04T11:20:23.849Z","dependencies_parsed_at":"2024-01-29T19:30:49.257Z","dependency_job_id":"8fb0ed5b-97fd-46cc-875e-5bddeb4a9f5c","html_url":"https://github.com/petitpress/gps-messenger-bundle","commit_stats":{"total_commits":20,"total_committers":7,"mean_commits":2.857142857142857,"dds":0.65,"last_synced_commit":"bbfbb087fedf01d0b1a22b20656ba0bb43d661ba"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitpress%2Fgps-messenger-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitpress%2Fgps-messenger-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitpress%2Fgps-messenger-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitpress%2Fgps-messenger-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petitpress","download_url":"https://codeload.github.com/petitpress/gps-messenger-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247721888,"owners_count":20985085,"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":["google","google-cloud-pubsub","google-cloud-sdk","message-queue","symfony","symfony-bundle","symfony-messenger"],"created_at":"2024-08-13T07:03:16.867Z","updated_at":"2025-04-09T20:42:22.954Z","avatar_url":"https://github.com/petitpress.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"Google Pub/Sub transport implementation for Symfony Messenger\n========\n\nThis bundle provides a simple implementation of Google Pub/Sub transport for Symfony Messenger.\n\nThe bundle requires only `symfony/messenger`, `google/cloud-pubsub` and `symfony/options-resolver` packages. \nIn contrast with [Enqueue GPS transport](https://github.com/php-enqueue/gps),\nit doesn't require [Enqueue](https://github.com/php-enqueue) \nand [some bridge](https://github.com/sroze/messenger-enqueue-transport#readme).\n\n## Features\n\n- **Compatible with the latest `google/cloud-pubsub` 2.***.\n- **Zero extra dependencies** beyond core Symfony (e.g. `Symfony Messenger`) and Pub/Sub libraries.\n- **Flexible and extensive configuration**, available via options or DSN (Data Source Name), including `deadLetterPolicy`, `enableMessageOrdering`, `ackDeadlineSeconds`).\n- **Automatic Pub/Sub Topic and Subscription creation**, with the ability to disable it if needed.\n- **Message ordering support** using the `OrderingKeyStamp`.\n- **Keep-alive support** for long-running Messenger workers.\n\n## Support\n\n| Version                                                               | Status             | Symfony Versions |\n|-----------------------------------------------------------------------|--------------------|------------------|\n| [3.x](https://github.com/petitpress/gps-messenger-bundle/tree/3.x)    | Actively Supported | \u003e= 5.4, \u003c=7.1    |\n| [4.x](https://github.com/petitpress/gps-messenger-bundle/tree/master) | In development     | \u003e= 7.2           |\n\n## Installation\n\n### Step 1: Install the Bundle\n\nFrom within container execute the following command to download the latest version of the bundle:\n\n```console\n$ composer require petitpress/gps-messenger-bundle --no-scripts\n```\n\n### Step 2: Configure environment variables\n\nOfficial [Google Cloud PubSub SDK](https://github.com/googleapis/google-cloud-php-pubsub) \nrequires some globally accessible environment variables.\n\nYou might need to change default Symfony DotEnv instance to use `putenv` \nas Google needs to access some variables through `getenv`. To do so, use putenv method in `config/bootstrap.php`:\n```php\n(new Dotenv())-\u003eusePutenv()-\u003e...\n```\n\nList of Google Pub/Sub configurable variables :\n```dotenv\n# use these for production environment:\nGOOGLE_APPLICATION_CREDENTIALS='google-pubsub-credentials.json'\nGCLOUD_PROJECT='project-id'\n\n# use these for development environment (if you have installed Pub/Sub emulator):\nPUBSUB_EMULATOR_HOST=http://localhost:8538\n```\n\nor if you have credentials in a base64 encoded env variable:\n```yaml\n# config/packages/messenger.yaml\n\nframework:\n    messenger:\n        transports:\n            gps_transport:\n                dsn: 'gps://default'\n                options:\n                    client_config:\n                        credentials: '%env(json:base64:GOOGLE_PUBSUB_KEY)%'\n```\n\n### Step 3: Configure Symfony Messenger\n\n```yaml\n# config/packages/messenger.yaml\n\nframework:\n    messenger:\n        transports:\n            gps_transport:\n                dsn: 'gps://default'\n                options:\n                    client_config: # optional (default: [])\n                        apiEndpoint: 'https://europe-west3-pubsub.googleapis.com'\n                    topic: # optional (default name: messages)\n                        name: 'messages'\n                        options: # optional create options if not exists (default: []), for all options take at look at https://cloud.google.com/php/docs/reference/cloud-pubsub/latest/Topic#_Google_Cloud_PubSub_Topic__create__\n                            labels:\n                                - label1\n                                - label2\n                    subscription: # optional (default the same as topic.name)\n                        name: 'messages'\n                        options: # optional create options if not exists (default: []), for all options take a look at https://cloud.google.com/php/docs/reference/cloud-pubsub/latest/Subscription#_Google_Cloud_PubSub_Subscription__create__\n                            enableExactlyOnceDelivery: true\n                            labels:\n                                - label1\n                                - label2\n                        pull:\n                            maxMessages: 10 # optional (default: 10)\n\n```\nor:\n```yaml\n# config/packages/messenger.yaml\n\nframework:\n    messenger:\n        transports:\n            gps_transport:\n                dsn: 'gps://default/messages?client_config[apiEndpoint]=https://europe-west3-pubsub.googleapis.com\u0026subscription[pull][maxMessages]=10'\n```\nto use emulator in local:\n```yaml\n# config/packages/dev/messenger.yaml\n\nframework:\n    messenger:\n        transports:\n            gps_transport:\n                options:\n                    client_config:\n                        hasEmulator: true\n                        emulatorHost: '%env(PUBSUB_EMULATOR_HOST)%'\n```\n\n\n### Step 4: Configure PetitPressGpsMessengerBundle (optional)\n\nConfigure the cache service where authentication tokens are stored. The default is `cache.app`.\n\n```yaml\n# config/packages/petit_press_gps_messenger.yaml\n\npetit_press_gps_messenger:\n    auth_cache: 'cache.app'\n```\n\n### Step 5: Use available stamps if needed\n\n* `OrderingKeyStamp`: use for keeping messages of the same context in order. \n  For more information, read an [official documentation](https://cloud.google.com/pubsub/docs/publisher#using_ordering_keys).\n\n* `AttributesStamp`: use to add contextual metadata to serialized messages. \n  For more information, read an [official documentation](https://cloud.google.com/pubsub/docs/publisher#using-attributes). \n  Can be very useful when used together with [subscription filters](https://cloud.google.com/pubsub/docs/subscription-message-filter).\n\n### Step 6: Create topics from config\n\n```bash\nbin/console messenger:setup-transports\n```\n\n## License\n\nThis bundle is released under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetitpress%2Fgps-messenger-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetitpress%2Fgps-messenger-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetitpress%2Fgps-messenger-bundle/lists"}