Pulsar.PartitionTopic (Pulsar v2.10.0)

Copy Markdown View Source

The naming convention for the individual partitions of a partitioned topic: "<base>-partition-<index>".

This is also used for the per-partition consumer/producer group names, which follow the same suffix convention.

Summary

Functions

Extracts the numeric partition index from a partition topic/group name.

Builds the partition name for base (a topic or group name) at index.

Functions

index(partition_name)

@spec index(String.t() | atom()) :: non_neg_integer()

Extracts the numeric partition index from a partition topic/group name.

iex> Pulsar.PartitionTopic.index("persistent://public/default/t-partition-3")
3

name(base, index)

@spec name(String.t(), non_neg_integer()) :: String.t()

Builds the partition name for base (a topic or group name) at index.

iex> Pulsar.PartitionTopic.name("persistent://public/default/t", 3)
"persistent://public/default/t-partition-3"