Data Subscription
The information in this document is related to the TDengine data subscription feature.
Create a Topic
CREATE TOPIC [IF NOT EXISTS] topic_name AS subquery;
You can use filtering, scalar functions, and user-defined scalar functions with a topic. JOIN, GROUP BY, windows, aggregate functions, and user-defined aggregate functions are not supported. The following rules apply to subscribing to a column:
- The returned field is determined when the topic is created.
- Columns to which a consumer is subscribed or that are involved in calculations cannot be deleted or modified.
- If you add a column, the new column will not appear in the results for the subscription.
- If you run
SELECT \*
, all columns in the subscription at the time of its creation are displayed. This includes columns in supertables, standard tables, and subtables. Supertables are shown as data columns plus tag columns.
Delete a Topic
DROP TOPIC [IF EXISTS] topic_name;
If a consumer is subscribed to the topic that you delete, the consumer will receive an error.
View Topics
SHOW TOPICS
SHOW TOPICS;
The preceding command displays all topics in the current database.
Create Consumer Group
You can create consumer groups only through the TDengine Client driver or the API provided by a connector.
Delete Consumer Group
DROP CONSUMER GROUP [IF EXISTS] cgroup_name ON topic_name;
This deletes the cgroup_name in the topic_name.
View Consumer Groups
SHOW CONSUMERS;
The preceding command displays all consumer groups in the current database.