1. StreamNative Cloud
  2. Use

Work with topics

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 add more partitions to the topic after it is created.

Work with topics through snctl

In this release, snctl does not support creating topics. You can create a topic for the organization through StreamNative Cloud Console. For details about how to create a topic, see create topic. You can use pulsarctl to manage topics.

Work with topics through StreamNative Cloud Console

This section describes how to work with topics through the StreamNative Cloud Console.

Create a topic

To create a topic, follow these steps.

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

  2. Click New Topic.

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

Manage topics

This section describes how to manage topics through the StreamNative Cloud Console.

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.

    image 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 Cloud 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 Cloud 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

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.

    image 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 information about messages in this topic.

    ItemDescription
    Subscription NameThe subscription name of the topic.
    TypeThe subscription type of the topic. Currently, the StreamNative Cloud 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

  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 policies for topics

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.

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

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 namespace