Stay organized with collections
Save and categorize content based on your preferences.
Single message transforms (SMTs) can be set as properties of topics or
subscriptions.
A topic SMT applies transformations to the messages before the messages are
persisted for a topic.
A subscription SMT applies transformations to the messages before the
messages are delivered to a subscription.
The following are some reasons for applying an SMT to a topic instead of a
subscription:
You want multiple subscriptions on the same topic to receive the transformed message.
If all subscriptions on a topic are supposed to
receive the transformed message, then it is better to apply the
transformation one time on the publish side.
You want to minimize storage, inter-region delivery, and subscriber delivery costs.
If you remove unnecessary fields from a message using an
SMT defined on a topic, then all subsequent data processing and delivery
operations benefit from the reduced message footprint.
You want to handle invalid messages at publish time. If you use an SMT
on a topic to validate messages, then any publish with an invalid message is
going to fail. You can decide in the publisher how to handle these failures.
The following are some reasons for applying an SMT to a subscription instead of
a topic:
You only need transformations for a single subscription. A subscription
SMT is useful when you only need transformations for a single subscription.
You want to write invalid messages to a dead-letter topic. You can also
use subscription SMTs with dead-letter topics to archive failed
transformations. The errors result in messages being routed to the
designated dead-letter topic.
You can combine topic and subscription SMTs to perform independent
transformations on a single message.
[[["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."],[],[],null,["# Choose topic or subscription SMTs\n\nSingle message transforms (SMTs) can be set as properties of topics or\nsubscriptions.\n\n- A topic SMT applies transformations to the messages before the messages are\n persisted for a topic.\n\n- A subscription SMT applies transformations to the messages before the\n messages are delivered to a subscription.\n\nThe following are some reasons for applying an SMT to a topic instead of a\nsubscription:\n\n- **You want multiple subscriptions on the same topic to receive the transformed message**.\n If all subscriptions on a topic are supposed to\n receive the transformed message, then it is better to apply the\n transformation one time on the publish side.\n\n- **You want to minimize storage, inter-region delivery, and subscriber delivery costs**.\n If you remove unnecessary fields from a message using an\n SMT defined on a topic, then all subsequent data processing and delivery\n operations benefit from the reduced message footprint.\n\n- **You want to handle invalid messages at publish time.** If you use an SMT\n on a topic to validate messages, then any publish with an invalid message is\n going to fail. You can decide in the publisher how to handle these failures.\n\nThe following are some reasons for applying an SMT to a subscription instead of\na topic:\n\n- **You only need transformations for a single subscription.** A subscription\n SMT is useful when you only need transformations for a single subscription.\n\n- **You want to write invalid messages to a dead-letter topic.** You can also\n use subscription SMTs with dead-letter topics to archive failed\n transformations. The errors result in messages being routed to the\n designated dead-letter topic.\n\nYou can combine topic and subscription SMTs to perform independent\ntransformations on a single message.\n\nWhat's next\n-----------\n\n- [Create a topic with SMTs](/pubsub/docs/smts/create-topic-smt)\n\n- [Create a subscription with SMTs](/pubsub/docs/smts/create-subscription-smt)"]]