Skip to content

constants

topic_name

topic_name(partition_id, replay_id=None)

Construct a Kafka topic name for a given partition.

Parameters:

Name Type Description Default
partition_id str

The partition identifier.

required
replay_id str

If set, returns a replay-namespaced topic.

None

Returns:

Type Description
str

The topic name.

Source code in arrakis/constants.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def topic_name(partition_id: str, replay_id: str | None = None) -> str:
    """Construct a Kafka topic name for a given partition.

    Parameters
    ----------
    partition_id : str
        The partition identifier.
    replay_id : str, optional
        If set, returns a replay-namespaced topic.

    Returns
    -------
    str
        The topic name.

    """
    if replay_id is not None:
        return f"{REPLAY_TOPIC_PREFIX}-{replay_id}-{partition_id}"
    return f"{TOPIC_PREFIX}-{partition_id}"