genesis-global/gps-messenger-bundle
Composer 安装命令:
composer require genesis-global/gps-messenger-bundle
包简介
Fork of petitpress/gps-messenger-bundle with support for PHP 7.3
README 文档
README
This bundle provides a simple implementation of Google Pub/Sub transport for Symfony Messenger.
The bundle requires only symfony/messenger, google/cloud-pubsub and symfony/options-resolver packages.
In contrast with Enqueue GPS transport,
it doesn't require Enqueue
and some bridge.
It supports ordering messages with OrderingKeyStamp and it's not outdated.
Installation
Step 1: Install the Bundle
From within container execute the following command to download the latest version of the bundle:
$ composer require petitpress/gps-messenger-bundle --no-scripts
Step 2: Configure environment variables
Official Google Cloud PubSub SDK requires some globally accessible environment variables.
You might need to change default Symfony DotEnv instance to use putenv
as Google needs to access some variables through getenv. To do so, use putenv method in config/bootstrap.php:
(new Dotenv())->usePutenv()->...
List of Google Pub/Sub configurable variables :
# use these for production environemnt: GOOGLE_APPLICATION_CREDENTIALS='google-pubsub-credentials.json' GCLOUD_PROJECT='project-id' # use these for development environemnt (if you have installed Pub/Sub emulator): PUBSUB_EMULATOR_HOST=http://localhost:8538
Step 3: Configure Symfony Messenger
# config/packages/messenger.yaml framework: messenger: transports: gps_transport: dsn: 'gps://default' options: key_file_path: /path/to/gcp-key.json #optional. Can be used instead of setting environment variables. max_messages_pull: 10 # optional (default: 10) topic: # optional (default name: messages) name: 'messages' queue: # optional (default the same as topic.name) name: 'messages' batch_size: 0 # optional (default: 0) If set above 0 it uses pubsubs batch publisher
or:
# config/packages/messenger.yaml framework: messenger: transports: gps_transport: dsn: 'gps://default/messages?max_messages_pull=10&key_file_path=/path/to/gcp-key.json'
Step 4: Use available stamps if needed
OrderingKeyStamp: use for keeping messages of the same context in order. For more information, read an official documentation.
统计信息
- 总下载量: 1.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-16