Skip to main content

Google Cloud Pub/Sub

Google Cloud Pub/SubExternal LinkThis link leads to an external website and will open in a new tab is a versatile, real-time messaging service designed to connect separate applications and services. It follows the publisher-subscriber model, which allows you to decouple the systems that "produce" data from the systems that "consume" it.

Think of Google Cloud Pub/Sub as the reliable "postal service" for your digital ecosystem. In a modern SaaS environment, different parts of your software often need to talk to each other, but they don't always operate at the same speed. Pub/Sub acts as a smart intermediary that catches messages and ensures they are delivered to the right destination without the sender having to wait for a response.

Files.com can publish messages to Google Cloud Pub/Sub about file and folder operations that occur within your site. These messages provide real-time notifications for events such as file uploads, downloads, moves, and deletions. By integrating with Pub/Sub, you can trigger automated workflows, synchronize data across external systems, or stream audit logs into your own data processing pipelines for further analysis.

How Google Cloud Pub/Sub Notifications Work

To send messages from your site to Google Cloud Pub/Sub, you need to define your Project and Pub/Sub Topic within Google Cloud, along with a service account that can publish to your topic.

After the Pub/Sub Topic and your service account exist in your Google Cloud environment, add a Google Cloud Pub/Sub Topic notification in your Files.com site. Provide the Project ID, Topic ID, and the credentials for your service account.

Pub/Sub Topic notifications are processed in real-time by your site. When matching file activity happens in your folder, a message is sent to the Pub/Sub Topic with the details.

All of the message handling happens within Google Cloud Pub/Sub, including delivering to all of the message subscribers.

What is Included in Google Cloud Pub/Sub Notification Messages

Messages sent by Files.com about a file include the type of activity that occurred, which path(s) were affected, the username who performed the action, and the size of the file.

Messages about a folder rather than a file will not include the file size because folders do not have a file size. Operations performed using a site-wide API key are not associated with a user, so no username is included for those actions.

Timing of Google Cloud Pub/Sub Messages from Files.com

Your site will send messages to your Pub/Sub Topic within seconds of the folder activity completing. Once the activity has happened, your site does not add any delay before sending the messages.

Configuration in Google Cloud

Start by going to the Google Cloud ConsoleExternal LinkThis link leads to an external website and will open in a new tab and selecting your project. If you don't already have a Pub/Sub Topic, create a new one. Take note of the Project ID and Topic ID.

Create a service account that will be used only by Files.com. Give it a descriptive name such as filescom-pubsub-publisher. Assign it the Pub/Sub Publisher role (roles/pubsub.publisher), which allows it to publish messages to topics but nothing beyond that.

Generate a JSON key for your service account. Treat the JSON key like a password. Share it only over secure channels, and avoid checking it into source control. If the key is ever compromised, you can revoke it at any time from the Service Accounts page in the Google Cloud Console.

Creating a Google Pub/Sub Notification

Before you can create the Google Cloud Pub/Sub notification in your Files.com site, you must first complete the configuration in Google Cloud.

Only users with administrator-level access to your site, Workspace or the folder can configure Google Cloud Pub/Sub notifications for a folder.

Add a new Google Pub/Sub notification for the desired folder in Files.com, and provide your Project ID, Topic ID and the Google Credentials JSON Key for the service account user who has permission to publish to the topic.

You must choose which folder's activity will generate messages for the notification.

Activity in the folder and its subfolders is included by default; you can change this to only generate messages for actions occurring directly in the selected folder. Activity in a mounted folder within your folder will not generate messages if it occurs outside of the Files.com platform.

By default, notifications are for any file or folder action (create, read, update, delete, move, or copy) within the configured folder. You can limit which actions generate notifications.

There is no waiting period after enabling the new notification in your Files.com site; any matching activity will immediately generate messages.

Common Failure Patterns

A successful connection from Files.com to Google Cloud Pub/Sub requires specific configuration. If your notification isn't working, check for these common problems in your Google Cloud environment:

Verify that the JSON key used for the connection was not deleted or deactivated in Google Cloud Console. Service account keys can be manually revoked or deleted by anyone with IAM admin access in your organization. If it has been deleted, generate a new JSON key and update your notification with the new key.

Make sure the service account is still present and enabled. Service accounts can be disabled or deleted independently of their keys. If it was deleted, you'll need to create a new service account, assign the Pub/Sub Publisher role, generate a new JSON key, and update your notification with the new key.

If the service account is still active and enabled, verify that it has the Pub/Sub Publisher role. IAM roles can be changed by any admin in your organization, sometimes inadvertently during a broader permissions cleanup. If the role was removed, re-add it so that publishing can resume.

Verify the Pub/Sub Topic exists and that the name has not changed. If the target topic was deleted or recreated under a different name, publishing will fail. If it was recreated under a new name, provide Files.com with the updated Topic ID.

Make sure the project has not been changed or migrated. If your Google Cloud resources were reorganized into a different project, the Project ID on file with Files.com may no longer be valid. Confirm that the topic still lives in the same project and that the Project ID provided to Files.com matches.

Make sure the Pub/Sub API is enabled for your Google Cloud environment. The Cloud Pub/Sub API must be enabled in your project for publishing to work.