google-cloud-pubsub is a library for interacting with the Google Cloud Pub/Sub API.
Dependencies
= { = "<version>" }
Configuration items
[]
= true # Whether to enable the pubsub plugin, default true
= "your-project-id" # The project id of the google cloud project
= "path/to/credentials.json" # The path to the credentials file
= "https://pubsub.googleapis.com" # The endpoint of the pubsub api in case you are using the pubsub emulator
The credentials file is a JSON file that contains the credentials to access the pubsub api. You can get the credentials file from the Google Cloud Console.
Components
When the plugin is enabled, it will automatically register a PubSubSubscriber component.
PubSubProducer is a component that allows you to publish messages to the pubsub topic.
Besides you can create a handler for each subscription and register it to the app.
async
On the handler, you can use Component to extract the components registered in the app or configs using Config.
use ;
use ;
use ConnectPool;
async
The order of the parameters is not important in the handler, you can use the parameters in the handler as you like.
You can combine the PubSubProducer in web handler to publish messages to the pubsub topic.
use IntoResponse;
use Component;
use get;
use ;
use Message;
async