- StreamNative Console
Work with topics
Note
This document introduces the instructions for working with topics on StreamNative Console. The details may vary depending on the specific product and version number that you use.
Topic Overview
A topic is a named channel used to deliver messages published by producers to consumers. After creating a namespace, you can create one or more topics for the namespace. It's recommended to have at least one partition per topic so that you can add more partitions in the future. If there are zero partitions (a non-partitioned topic), you will not be able to add more partitions to the topic after it is created.
As in other pub-sub systems, topics in Pulsar are named channels for transmitting messages from producers to consumers. Pulsar supports persistent and non-persistent topics. By default, a persistent topic is created if you do not specify a topic type. With persistent topics, all messages are durably persisted on disks (if the broker is not standalone, messages are durably persisted on multiple disks), whereas data for non-persistent topics is not persisted to storage disks.
Non-persistent topics
Pulsar also supports non-persistent topics, which are topics on which messages are never persisted to disk and live only in memory. When using non-persistent delivery, stopping a Pulsar broker or disconnecting a subscriber to a topic means that all in-transit messages are lost on that non-persistent topic. In non-persistent topics, brokers immediately deliver messages to all connected subscribers without persisting them in BookKeeper.
Partitioned topics
Normal topics are served only by a single broker that limits the maximum throughput of the topic. Partitioned topics are a special type of topic handled by multiple brokers, allowing for higher throughput.
A partitioned topic is actually implemented as N internal topics, where N is the number of partitions. When publishing messages to a partitioned topic, each message is routed to one of several brokers. The distribution of partitions across brokers is handled automatically by Pulsar.
It's recommended to have at least one partition per topic so that you can add more partitions in the future. If there are zero partitions (a non-partitioned topic), you will not be able to add more partitions to the topic after it is created.
Create a topic
To create a topic, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click New Topic.
Configure the topic, as outlined in the following table.
Item Description Domain Configure the type of the topic.
- Persistent: messages in a persistent topic are durably persisted on the storage disk.
- Non-persistent: messages in a non-persistent topic are not persisted on the storage disk.
By default, it is set to Persistent.Topic Name Enter a name for the topic. It is a string of up to 40 characters, supporting lowercase letters (a-z), numeric characters (0-9), and the special character hyphen (-). Partitions (Optional) Configure the number of partitions for a partitioned topic. You can have from 1 up to 100 partitions per topic. It's recommended to have at least 1 partition. Click Confirm.
(Optional) Click New Topic to add more topics for the namespace.
Note
Currently, snctl does not support creating topics.
Manage topics
This section describes how to manage topics through the StreamNative Console. For how to use pulsarctl to manage topics, see pulsarctl command reference.
Perform basic operations for topics
You can view detailed information about the target topic, unload, terminate, compact, and offload topics, as well as configure the subscription name of the topics.
To perform basic operations for a topic, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click the topic name link to display detailed information about that topic.
If the topic is partitioned, click the partition link of the selected topic.
Select the OVERVIEW tab.
On the OVERVIEW tab, you can perform the following operations.
- Unload the topic: click Unload to unload the topic.
- Terminate the topic: click Terminate to terminate the topic.
- Compact the topic: click Compact to compact the topic.
- Configure the subscription name of the topic: click New Subscription and a dialog box displays. Enter a name for the subscription and then click Confirm. Thereafter, the StreamNative Console can manage topics based on the subscription name.
- Check detailed information about the topic.
The following table outlines detailed information about the topic.
Item Description Info In Rate The ingress rate of the topic. Out Rate The egress rate of the topic. In Throughput The ingress throughput of the topic. Out Throughput The egress throughput of the topic. Producers Producer Id The producer ID of the topic. Producer Name The producer name of the topic. In Rate The ingress rate of the topic. In Throughput The ingress throughput of the topic. Avg Msg Size The average message size of the topic. Address The address of the topic. Since When the producer is created. Subscriptions Subscription Name The subscription name of the topic. Type The subscription type of the topic. Currently, the StreamNative Console does not support configuring the subscription type for a topic. You can configure the subscription type through Pulsar manager. Out Rate The egress rate of the topic. Out Throughput The egress throughput of the topic. Msg Expired The expired messages for the topic. Backlog Configure the backlog for the subscription.
- SKIP: skip some messages for the subscription.
- EXPIRE: expire messages that are older than the given expiry time (in seconds) for the subscription.
- CLEAR: clear the backlog for the subscription.
- RESET BY ID: reset the ID of the message at which the subscription is created.
- RESET BY TIME: reset the time when the subscription is created.
- PEEK: peek some messages for the subscription.
- UNSUBSCRIBE: delete the subscription.
Create schema for topics
Note
Currently, only Avro and JSON schema are supported.
To configure schema for topics, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click the topic name link.
If the topic is partitioned, click the partition link of the selected topic.
Select the Schema tab. The Create a Pulsar schema page displays.
Select a schema type from the Schema Type drop-down list.
Configure the key and the value and then click Confirm.
Check messages
On the left navigation pane, under Resources, click Topics.
Click the link of the topic name to display detailed information about the topic.
If the topic is partitioned, click the partition link of the selected topic.
Select the MESSAGES tab and check the information about messages in this topic.
Item Description Subscription Name The subscription name of the topic. Type The subscription type of the topic. Currently, the StreamNative Console does not support configuring the subscription type for a topic. You can configure the subscription type through Pulsar Manager. Out Rate The egress rate of the topic. Out Throughput The egress throughput of the topic. Msg Expired The expired messages for the topic. PEEK The messages peeked for the subscription.
- message ID: the IDs of the peeked messages.
- Message: the peeked messages.
Check storage
To check the storage for topics, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click the link of the topic name.
If the topic is partitioned, click the partition link of the selected topic.
Select the Storage tab and check storage information for this topic.
Item Description Storage size The storage size. Entries The entries. Segments The segments. Ledgers Ledger Id The ledger ID Entries The total number of entries that belong to the ledger. Size The size of messages written to the ledger (in bytes). Status The state of the ledger for writing messages. If it is set to Opening
, the ledger is open for saving published messages.Offload Whether the ledger can be offloaded or not. Cursors Cursor The cursor ID. Mark Delete Position All messages before the markDeletePosition
are acknowledged by the subscriber.Read Position The latest position for the subscriber to read messages. Waiting Read Op It is set to True
when the subscription has read the latest message published to the topic and is waiting for new messages to be published.Pending Read Op The number of read requests to the BookKeepers in progress. Entries Since First Not AckedMessage Entries that are not acknowledged.
Configure topic policies
To configure policies for topics, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click the link of the topic name.
If the topic is partitioned, click the partition link of the selected topic.
Select the POLICIES tab and configure authorization policies for the topic.
Item Description Authorization Grant/Revoke permissions to other client roles.
- consume: grant/revoke the consuming action.
- produce: grant/revoke the producing action.
- functions: grant/revoke the Pulsar functions action.(Optional) click Add Role to add more permissions for the topic.
View topic statistics
You can find the latest statistics for a topic and its connected producers and consumers on StreamNative Console, for example, whether the topic has received messages, whether there's a backlog, and so on.
To view the statistics of a topic, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click the link of the topic name.
If the topic is partitioned, click the partition link of the selected topic.
Select the STATS tab, and you can see the statistics about a topic over the past 1 minute.
To view the latest stats to monitor your cluster in real time, click RELOAD TOPIC STATS.
Delete topics
To delete a topic, follow these steps.
On the left navigation pane, under Resources, click Topics.
Click the link of the topic name.
If the topic is partitioned, click the partition link of the selected topic.
Select the Policies tab and then click Delete Topic.
A dialog box displays asking, Are you sure you want to delete this?
Enter the topic name and then click Confirm.