Reference documentation and code samples for the Cloud PubSub V1 Client class MessageStoragePolicy.
A policy constraining the storage of messages published to the topic.
Generated from protobuf messagegoogle.pubsub.v1.MessageStoragePolicy
Namespace
Google \ Cloud \ PubSub \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ allowed_persistence_regions
array
Optional. A list of IDs of Google Cloud regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed Google Cloud regions (or running outside of Google Cloud altogether) are routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.
↳ enforce_in_transit
bool
Optional. If true,allowed_persistence_regionsis also used to enforce in-transit guarantees for messages. That is, Pub/Sub will fail Publish operations on this topic and subscribe operations on any subscription attached to this topic in any region that is not inallowed_persistence_regions.
getAllowedPersistenceRegions
Optional. A list of IDs of Google Cloud regions where messages that are
published to the topic may be persisted in storage. Messages published by
publishers running in non-allowed Google Cloud regions (or running outside
of Google Cloud altogether) are routed for storage in one of the allowed
regions. An empty list means that no regions are allowed, and is not a
valid configuration.
Optional. A list of IDs of Google Cloud regions where messages that are
published to the topic may be persisted in storage. Messages published by
publishers running in non-allowed Google Cloud regions (or running outside
of Google Cloud altogether) are routed for storage in one of the allowed
regions. An empty list means that no regions are allowed, and is not a
valid configuration.
Parameter
Name
Description
var
string[]
Returns
Type
Description
$this
getEnforceInTransit
Optional. If true,allowed_persistence_regionsis also used to enforce
in-transit guarantees for messages. That is, Pub/Sub will fail
Publish operations on this topic and subscribe operations
on any subscription attached to this topic in any region that is
not inallowed_persistence_regions.
Returns
Type
Description
bool
setEnforceInTransit
Optional. If true,allowed_persistence_regionsis also used to enforce
in-transit guarantees for messages. That is, Pub/Sub will fail
Publish operations on this topic and subscribe operations
on any subscription attached to this topic in any region that is
not inallowed_persistence_regions.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud PubSub V1 Client - Class MessageStoragePolicy (2.13.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.2 (latest)](/php/docs/reference/cloud-pubsub/latest/V1.MessageStoragePolicy)\n- [2.13.1](/php/docs/reference/cloud-pubsub/2.13.1/V1.MessageStoragePolicy)\n- [2.12.0](/php/docs/reference/cloud-pubsub/2.12.0/V1.MessageStoragePolicy)\n- [2.11.3](/php/docs/reference/cloud-pubsub/2.11.3/V1.MessageStoragePolicy)\n- [2.10.1](/php/docs/reference/cloud-pubsub/2.10.1/V1.MessageStoragePolicy)\n- [2.9.1](/php/docs/reference/cloud-pubsub/2.9.1/V1.MessageStoragePolicy)\n- [2.8.2](/php/docs/reference/cloud-pubsub/2.8.2/V1.MessageStoragePolicy)\n- [2.7.0](/php/docs/reference/cloud-pubsub/2.7.0/V1.MessageStoragePolicy)\n- [2.6.0](/php/docs/reference/cloud-pubsub/2.6.0/V1.MessageStoragePolicy)\n- [2.5.2](/php/docs/reference/cloud-pubsub/2.5.2/V1.MessageStoragePolicy)\n- [2.4.0](/php/docs/reference/cloud-pubsub/2.4.0/V1.MessageStoragePolicy)\n- [2.3.0](/php/docs/reference/cloud-pubsub/2.3.0/V1.MessageStoragePolicy)\n- [2.2.1](/php/docs/reference/cloud-pubsub/2.2.1/V1.MessageStoragePolicy)\n- [2.1.2](/php/docs/reference/cloud-pubsub/2.1.2/V1.MessageStoragePolicy)\n- [1.50.0](/php/docs/reference/cloud-pubsub/1.50.0/V1.MessageStoragePolicy)\n- [1.49.0](/php/docs/reference/cloud-pubsub/1.49.0/V1.MessageStoragePolicy)\n- [1.48.0](/php/docs/reference/cloud-pubsub/1.48.0/V1.MessageStoragePolicy)\n- [1.47.0](/php/docs/reference/cloud-pubsub/1.47.0/V1.MessageStoragePolicy)\n- [1.46.5](/php/docs/reference/cloud-pubsub/1.46.5/V1.MessageStoragePolicy)\n- [1.45.2](/php/docs/reference/cloud-pubsub/1.45.2/V1.MessageStoragePolicy)\n- [1.44.0](/php/docs/reference/cloud-pubsub/1.44.0/V1.MessageStoragePolicy)\n- [1.43.2](/php/docs/reference/cloud-pubsub/1.43.2/V1.MessageStoragePolicy)\n- [1.42.1](/php/docs/reference/cloud-pubsub/1.42.1/V1.MessageStoragePolicy)\n- [1.41.3](/php/docs/reference/cloud-pubsub/1.41.3/V1.MessageStoragePolicy)\n- [1.40.1](/php/docs/reference/cloud-pubsub/1.40.1/V1.MessageStoragePolicy)\n- [1.39.3](/php/docs/reference/cloud-pubsub/1.39.3/V1.MessageStoragePolicy) \nReference documentation and code samples for the Cloud PubSub V1 Client class MessageStoragePolicy.\n\nA policy constraining the storage of messages published to the topic.\n\nGenerated from protobuf message `google.pubsub.v1.MessageStoragePolicy`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ PubSub \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getAllowedPersistenceRegions\n\nOptional. A list of IDs of Google Cloud regions where messages that are\npublished to the topic may be persisted in storage. Messages published by\npublishers running in non-allowed Google Cloud regions (or running outside\nof Google Cloud altogether) are routed for storage in one of the allowed\nregions. An empty list means that no regions are allowed, and is not a\nvalid configuration.\n\n### setAllowedPersistenceRegions\n\nOptional. A list of IDs of Google Cloud regions where messages that are\npublished to the topic may be persisted in storage. Messages published by\npublishers running in non-allowed Google Cloud regions (or running outside\nof Google Cloud altogether) are routed for storage in one of the allowed\nregions. An empty list means that no regions are allowed, and is not a\nvalid configuration.\n\n### getEnforceInTransit\n\nOptional. If true, `allowed_persistence_regions` is also used to enforce\nin-transit guarantees for messages. That is, Pub/Sub will fail\nPublish operations on this topic and subscribe operations\non any subscription attached to this topic in any region that is\nnot in `allowed_persistence_regions`.\n\n### setEnforceInTransit\n\nOptional. If true, `allowed_persistence_regions` is also used to enforce\nin-transit guarantees for messages. That is, Pub/Sub will fail\nPublish operations on this topic and subscribe operations\non any subscription attached to this topic in any region that is\nnot in `allowed_persistence_regions`."]]