Google Pub/Sub Push Subscription
Analytics Plus can stream messages from a Google Cloud Pub/Sub topic through a push subscription. Analytics Plus generates a unique Push URL for the stream table. Set this URL as the subscription endpoint, and Pub/Sub delivers each message as it is published.
Note: To have Analytics Plus read an existing pull subscription, see Google Pub/Sub Pull Subscription.
Before you begin
- Stream Analytics is available only in the Enterprise edition of Analytics Plus.
- You need a Google Cloud project with a Pub/Sub topic and permission to create subscriptions.
- Messages must be JSON whose keys match the table column names exactly, including case.
Note: Use flat JSON. A nested object is stored in a single text column.
Creating the stream table
- Click Import Your Data at the top-right corner of the Home page.
- Select Streaming Data in the Category list, and click Google Pub/Sub Push Subscription.
- If the Import Streaming Data into Analytics Plus pane appears, click Proceed.
- Enter a Workspace Name if you started from the Home page.
- Click Copy next to Post to copy the Push URL, and click Next.
Note: The Push URL contains a secret key. Use it only as the endpoint of the push subscription.
Configuring the push subscription
- In the Google Cloud Console, go to Pub/Sub > Subscriptions and click Create subscription.
- Select the topic that receives your events.
- Set Delivery type to Push, and set Endpoint URL to the Push URL.
- Select Enable payload unwrapping, and create the subscription.
Note: Payload unwrapping is required. Without it, Google wraps each message in its own fields and the stream table columns will not match.
Designing the table
| Option | Use it when | What happens |
| Design table manually | You know the keys and data types. | Add each column yourself. |
| Provide sample data | You have a sample message. | Analytics Plus fills the columns from the JSON. |
| Fetch data automatically from source | You can publish messages now. | Analytics Plus listens for up to 120 seconds and fills columns from received messages. |

Design the table manually
- Select Design table manually and click Next.
- Add a column for each JSON key and specify its data type.
Provide sample data
- Select Provide sample data.
- Paste a JSON object or array in Provide sample JSON.
- Click Next and review the generated columns.

Fetch data automatically from the source
- Confirm that payload unwrapping is enabled.
- Select Fetch data automatically from source.
- Publish one or more messages. Analytics Plus listens for up to 120 seconds and fills the columns when a message arrives.

Reviewing table details
- Enter a unique Table Name.
- Review each column's name, type, mandatory setting, default value, and personal-data setting.
- Add columns if required, and click Next.

Note: Use Decimal Number instead of Positive Number when a field can contain decimal values.
Validating and importing data
- Optionally set the retention period and turn on Enable Historical Data.
- Click Validate & Import Streaming Data.
- Publish a matching message to the topic within 120 seconds.

After a matching message arrives, the status changes to Consuming Streaming Data. If validation fails, review the Failure Reason(s), correct the issue, and click Validate Again.
Managing the data source

Open Data Sources in the workspace and select the Google Pub/Sub Push Subscription source. You can view the Push API URL, last fetched time, and stream status; validate, pause, or resume the stream; edit retention; and review failure details.
Regenerate Key creates a new Push URL and immediately disables the old URL. Update the subscription's Endpoint URL after regenerating the key.
Note: This data source holds one table. Start a new import for another table.
Retention and historical table
- Rows remain in the stream table for one hour by default. Set a retention period from 30 minutes to 24 hours.
- Enable Historical Data creates
{Stream table name} - Historical_Tableand copies each incoming row to it. - Turning the option off stops new rows but preserves the historical table and existing data.
Note: Historical table rows count toward the workspace row limit.
Streaming statuses
- Yet to be validated: Awaiting validation.
- Validating: Listening for 120 seconds.
- Consuming: Importing data.
- Paused: Import paused.
- Validation Failed: No matching message arrived.
- Failed: Repeated messages could not be processed.
Limits
- A stream table holds up to 1 million rows or one hour of data.
- This source holds one table.
- Stream tables cannot be copied.
- Reports refresh about every 30 seconds; dashboards require a manual refresh.
Frequently asked questions
Why is the table empty even though messages are being published?
Payload unwrapping is usually disabled. Enable it on the subscription, validate the stream, and publish another message.
Can I use a pull subscription with this service?
No. This source receives messages through a push subscription. Use Google Pub/Sub Pull Subscription for pull delivery.
Does pausing a stream delete its data?
No. Existing rows remain until the retention period removes them.

