1. 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.

For more information about topics, see topics.

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.

For more information about non-persistent topics, see non-persistent topics.

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. You can have from 1 up to 100 partitions per topic.

For more information about partitioned topics, see partitioned topics.

Create a topic

To create a topic, follow these steps.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click New Topic.

    screenshot of new topic dialog box

  3. Configure the topic, as outlined in the following table.

    ItemDescription
    DomainConfigure 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 NameEnter 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.
  4. Click Confirm.

  5. (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.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the topic name link to display detailed information about that topic.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the OVERVIEW tab.

    screenshot of topic 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.

    ItemDescription
    Info
    In RateThe ingress rate of the topic.
    Out RateThe egress rate of the topic.
    In ThroughputThe ingress throughput of the topic.
    Out ThroughputThe egress throughput of the topic.
    Producers
    Producer IdThe producer ID of the topic.
    Producer NameThe producer name of the topic.
    In RateThe ingress rate of the topic.
    In ThroughputThe ingress throughput of the topic.
    Avg Msg SizeThe average message size of the topic.
    AddressThe address of the topic.
    SinceWhen the producer is created.
    Subscriptions
    Subscription NameThe subscription name of the topic.
    TypeThe 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 RateThe egress rate of the topic.
    Out ThroughputThe egress throughput of the topic.
    Msg ExpiredThe expired messages for the topic.
    BacklogConfigure 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.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the topic name link.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the Schema tab. The Create a Pulsar schema page displays.

    screenshot of the create schema page

  5. Select a schema type from the Schema Type drop-down list.

  6. Configure the key and the value and then click Confirm.

Check messages

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the link of the topic name to display detailed information about the topic.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the MESSAGES tab and check the information about messages in this topic.

    ItemDescription
    Subscription NameThe subscription name of the topic.
    TypeThe 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 RateThe egress rate of the topic.
    Out ThroughputThe egress throughput of the topic.
    Msg ExpiredThe expired messages for the topic.
    PEEKThe 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.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the link of the topic name.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the Storage tab and check storage information for this topic.

    ItemDescription
    Storage sizeThe storage size.
    EntriesThe entries.
    SegmentsThe segments.
    Ledgers
    Ledger IdThe ledger ID
    EntriesThe total number of entries that belong to the ledger.
    SizeThe size of messages written to the ledger (in bytes).
    StatusThe state of the ledger for writing messages. If it is set to Opening, the ledger is open for saving published messages.
    OffloadWhether the ledger can be offloaded or not.
    Cursors
    CursorThe cursor ID.
    Mark Delete PositionAll messages before the markDeletePosition are acknowledged by the subscriber.
    Read PositionThe latest position for the subscriber to read messages.
    Waiting Read OpIt 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 OpThe number of read requests to the BookKeepers in progress.
    Entries Since First Not AckedMessageEntries that are not acknowledged.

Configure topic policies

To configure policies for topics, follow these steps.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the link of the topic name.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the POLICIES tab and configure authorization policies for the topic.

    screenshot of the topic policies tab

    ItemDescription
    AuthorizationGrant/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.
  5. (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.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the link of the topic name.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the STATS tab, and you can see the statistics about a topic over the past 1 minute.

  5. 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.

  1. On the left navigation pane, under Resources, click Topics.

  2. Click the link of the topic name.

  3. If the topic is partitioned, click the partition link of the selected topic.

  4. Select the Policies tab and then click Delete Topic.

  5. A dialog box displays asking, Are you sure you want to delete this?

  6. Enter the topic name and then click Confirm.

Previous
Work with Namespaces