public Duration MessageRetentionDuration { get; set; }
Optional. Indicates the minimum duration to retain a message after it is
published to the topic. If this field is set, messages published to the
topic in the last message_retention_duration are always available to
subscribers. For instance, it allows any attached subscription to seek to
a
timestamp
that is up to message_retention_duration in the past. If this field is
not set, message retention is controlled by settings on individual
subscriptions. Cannot be more than 31 days or less than 10 minutes.
public MessageStoragePolicy MessageStoragePolicy { get; set; }
Optional. Policy constraining the set of Google Cloud Platform regions
where messages published to the topic may be stored. If not present, then
no constraints are in effect.
Required. The name of the topic. It must have the format
"projects/{project}/topics/{topic}". {topic} must start with a letter,
and contain only letters ([A-Za-z]), numbers ([0-9]), dashes (-),
underscores (_), periods (.), tildes (~), plus (+) or percent
signs (%). It must be between 3 and 255 characters in length, and it
must not start with "goog".
[[["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-08-28 UTC."],[[["\u003cp\u003eThis webpage provides documentation for the \u003ccode\u003eTopic\u003c/code\u003e class within the Google Cloud Pub/Sub v1 API for .NET, which represents a resource for managing topics in the Pub/Sub service.\u003c/p\u003e\n"],["\u003cp\u003eThe page details the available versions of the \u003ccode\u003eTopic\u003c/code\u003e class, ranging from the latest version 3.23.0 down to 2.3.0, with hyperlinks to the specific documentation for each version.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTopic\u003c/code\u003e class inherits from \u003ccode\u003eobject\u003c/code\u003e and implements multiple interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, supporting various functionalities like deep cloning, message handling, and equality checks.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of the \u003ccode\u003eTopic\u003c/code\u003e class include settings for data ingestion, KMS key protection, labels, message retention, storage policies, message transforms, schema validation, and the topic's name and state, offering comprehensive control over topic configuration and behavior.\u003c/p\u003e\n"],["\u003cp\u003eThe document also lists the constructors available to create \u003ccode\u003eTopic\u003c/code\u003e objects and how to set these properties, with descriptions of each field's purpose, format, constraints, and data type.\u003c/p\u003e\n"]]],[],null,["# Cloud Pub/Sub v1 API - Class Topic (3.27.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.0 (latest)](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic)\n- [3.26.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.26.0/Google.Cloud.PubSub.V1.Topic)\n- [3.25.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.25.0/Google.Cloud.PubSub.V1.Topic)\n- [3.24.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.24.0/Google.Cloud.PubSub.V1.Topic)\n- [3.23.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.23.0/Google.Cloud.PubSub.V1.Topic)\n- [3.22.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.22.0/Google.Cloud.PubSub.V1.Topic)\n- [3.21.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.21.0/Google.Cloud.PubSub.V1.Topic)\n- [3.20.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.20.0/Google.Cloud.PubSub.V1.Topic)\n- [3.19.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.19.0/Google.Cloud.PubSub.V1.Topic)\n- [3.18.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.18.0/Google.Cloud.PubSub.V1.Topic)\n- [3.17.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.17.0/Google.Cloud.PubSub.V1.Topic)\n- [3.16.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.16.0/Google.Cloud.PubSub.V1.Topic)\n- [3.15.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.15.0/Google.Cloud.PubSub.V1.Topic)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.14.0/Google.Cloud.PubSub.V1.Topic)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.13.0/Google.Cloud.PubSub.V1.Topic)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.12.0/Google.Cloud.PubSub.V1.Topic)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.11.0/Google.Cloud.PubSub.V1.Topic)\n- [3.10.1](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.10.1/Google.Cloud.PubSub.V1.Topic)\n- [3.9.1](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.9.1/Google.Cloud.PubSub.V1.Topic)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.8.0/Google.Cloud.PubSub.V1.Topic)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.7.0/Google.Cloud.PubSub.V1.Topic)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.6.0/Google.Cloud.PubSub.V1.Topic)\n- [3.5.1](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.5.1/Google.Cloud.PubSub.V1.Topic)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.4.0/Google.Cloud.PubSub.V1.Topic)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.3.0/Google.Cloud.PubSub.V1.Topic)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.2.0/Google.Cloud.PubSub.V1.Topic)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.1.0/Google.Cloud.PubSub.V1.Topic)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/3.0.0/Google.Cloud.PubSub.V1.Topic)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.10.0/Google.Cloud.PubSub.V1.Topic)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.9.0/Google.Cloud.PubSub.V1.Topic)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.8.0/Google.Cloud.PubSub.V1.Topic)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.7.0/Google.Cloud.PubSub.V1.Topic)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.6.0/Google.Cloud.PubSub.V1.Topic)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.5.0/Google.Cloud.PubSub.V1.Topic)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.4.0/Google.Cloud.PubSub.V1.Topic)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.PubSub.V1/2.3.0/Google.Cloud.PubSub.V1.Topic) \n\n public sealed class Topic : IMessage\u003cTopic\u003e, IEquatable\u003cTopic\u003e, IDeepCloneable\u003cTopic\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Pub/Sub v1 API class Topic.\n\nA topic resource. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Topic \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Topic](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Topic](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Topic](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.PubSub.V1](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.PubSub.V1.dll\n\nConstructors\n------------\n\n### Topic()\n\n public Topic()\n\n### Topic(Topic)\n\n public Topic(Topic other)\n\nProperties\n----------\n\n### IngestionDataSourceSettings\n\n public IngestionDataSourceSettings IngestionDataSourceSettings { get; set; }\n\nOptional. Settings for ingestion from a data source into this topic.\n\n### KmsKeyName\n\n public string KmsKeyName { get; set; }\n\nOptional. The resource name of the Cloud KMS CryptoKey to be used to\nprotect access to messages published on this topic.\n\nThe expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.\n\n### Labels\n\n public MapField\u003cstring, string\u003e Labels { get; }\n\nOptional. See [Creating and managing labels](https://cloud.google.com/pubsub/docs/labels).\n\n### MessageRetentionDuration\n\n public Duration MessageRetentionDuration { get; set; }\n\nOptional. Indicates the minimum duration to retain a message after it is\npublished to the topic. If this field is set, messages published to the\ntopic in the last `message_retention_duration` are always available to\nsubscribers. For instance, it allows any attached subscription to [seek to\na\ntimestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)\nthat is up to `message_retention_duration` in the past. If this field is\nnot set, message retention is controlled by settings on individual\nsubscriptions. Cannot be more than 31 days or less than 10 minutes.\n\n### MessageStoragePolicy\n\n public MessageStoragePolicy MessageStoragePolicy { get; set; }\n\nOptional. Policy constraining the set of Google Cloud Platform regions\nwhere messages published to the topic may be stored. If not present, then\nno constraints are in effect.\n\n### MessageTransforms\n\n public RepeatedField\u003cMessageTransform\u003e MessageTransforms { get; }\n\nOptional. Transforms to be applied to messages published to the topic.\nTransforms are applied in the order specified.\n\n### Name\n\n public string Name { get; set; }\n\nRequired. The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.\n\n### SatisfiesPzs\n\n public bool SatisfiesPzs { get; set; }\n\nOptional. Reserved for future use. This field is set only in responses from\nthe server; it is ignored if it is set in any requests.\n\n### SchemaSettings\n\n public SchemaSettings SchemaSettings { get; set; }\n\nOptional. Settings for validating messages published against a schema.\n\n### State\n\n public Topic.Types.State State { get; set; }\n\nOutput only. An output-only field indicating the state of the topic.\n\n### TopicName\n\n public TopicName TopicName { get; set; }\n\n[TopicName](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.TopicName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/Google.Cloud.PubSub.V1.Topic#Google_Cloud_PubSub_V1_Topic_Name) resource name property."]]