[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[],[],null,["# Topic properties\n\nPub/Sub topic properties are the characteristics of a topic.\nYou can set topic properties when you create or update a topic.\n\nThis document describes the different topic properties\nyou can set for a topic.\n\nBefore you begin\n----------------\n\n- Learn about [topics](/pubsub/docs/publish-message-overview#about_topics) and the publish messages workflow.\n- [Create a topic](/pubsub/docs/create-topic).\n\nCommon topic properties\n-----------------------\n\nWhen you create a topic, you must specify a number of options to\nset up the topic. Some of these properties are common to all types of\ntopics and are discussed in the next sections.\n\n### Add a default subscription\n\nAdds a default subscription to the Pub/Sub topic. You can create\nanother subscription for the topic after the topic is created. The default\nsubscription has the following properties:\n\n- Subscription ID of `-sub`\n- Pull delivery type\n- Message retention duration of seven days\n- Expiration after 31 days of inactivity\n- Acknowledgment deadline of 10 seconds\n- Immediate retry policy\n\n### Schema\n\nA schema is a format that the message data field must follow. A\nschema is a contract between the publisher and subscriber that\nPub/Sub enforces.\n\nTopic schemas help standardize message types and\npermissions to allow them to be consumed by different teams in your\norganization. Pub/Sub creates a central authority for message\ntypes and permissions. To create a topic with schema, see\n[Create and manage schemas](/pubsub/docs/schemas).\n\n### Message retention duration\n\nSpecifies how long the Pub/Sub topic retains messages after\npublication. After the message retention duration is over, Pub/Sub\nmight discard the message regardless of its acknowledgment state. Message\nstorage fees are charged for storing all messages published to the topic.\n\n- Default = Not enabled\n- Minimum value = 10 minutes\n- Maximum value = 31 days\n\n### Use a customer-managed encryption key (CMEK)\n\nSpecifies if the topic is encrypted with a CMEK. Pub/Sub encrypts\nmessages with Google-owned and Google-managed encryption keys by default. If you specify this option,\nPub/Sub uses the envelope encryption pattern with CMEK. In this\napproach, Cloud KMS does not encrypt the messages. Instead, Cloud KMS encrypts\nthe Data Encryption Keys (DEKs) that Pub/Sub creates for each\ntopic.\n\nPub/Sub encrypts the messages using the newest DEK that was\ngenerated for the topic. Pub/Sub decrypts the messages shortly\nbefore they are delivered to subscribers.\n\nFor more information about creating a key, see [Configure message\nencryption](/pubsub/docs/encryption).\n\n### Single Message Transforms (SMTs)\n\nSpecifies lightweight modifications to message attributes and data directly\nwithin Pub/Sub. This enables data cleaning, filtering, or format\nconversion before the messages are published to the topic.\n\nFor more information, see [SMTs Overview](/pubsub/docs/smts/smts-overview) and\n[Create a topic with SMTs](/pubsub/docs/smts/create-topic-smt).\n\nWhat's next\n-----------\n\n- Create a [pull subscription](/pubsub/docs/create-subscription).\n- Create a [push subscription](/pubsub/docs/create-push-subscription).\n- Create a [BigQuery subscription](/pubsub/docs/create-bigquery-subscription).\n- Create a [Cloud Storage subscription](/pubsub/docs/create-cloudstorage-subscription)."]]