- Listen to the model data and generate events from it using Cloud Run functions.
- Send the Cloud Run functions generated events through the Pub/Sub event channel.
Supported models
The following models offer Cloud Run functions event generation and Pub/Sub event notification integrations:
- Occupancy analytics model
- Vertex AI custom-trained models
Before you begin
- Create an app with, at minimum, a stream node and a supported model node.
- Optional. Install the Gemini Enterprise Agent Platform Vision SDK and ingest data into your app. If you don't do this before you set up event notification you must do it after.
- Optional. Create a Cloud Run function to use. If you don't create your Cloud Run function before you configure Cloud Run functions to process model output, you must create it during that process.
- Optional. Create a Pub/Sub topic to use. If you don't create your Pub/Sub topic before you enable model event notification with Pub/Sub, you must create it during that process.
- Optional. Choose and create a Pub/Sub subscription. If you don't create your Pub/Sub subscription before you enable model event notification with Pub/Sub, you must create it after to read messages from a topic.
Configure Cloud Run functions to process model output
To trigger event-based notifications, you must first set up Cloud Run functions to process model output and generate events.
Your Cloud Run function connects to the model and listens to its output
as its post-processing action. The Cloud Run function you should return
an AppPlatformCloudFunctionResponse. The events
(appplatformeventbody) are
sent to the Pub/Sub topic you configure in the next step.
Sample Cloud Run function (occupancy analytics model)
Sample Cloud Run function
/**
* Responds to any HTTP request.
*
* @param {!express:Request} req HTTP request context.
* @param {!express:Response} res HTTP response context.
*/
exports.hello_http = (req, res) => {
// Logging statement can be read with cmd `gcloud functions logs read {$functionName}`.
// For more about logging, please see https://cloud.google.