Support any nr of parts in full_topic_name

This commit is contained in:
Nuno Campos
2023-09-15 11:59:11 +01:00
parent 60b1fe619c
commit 0e80272764
+2 -2
View File
@@ -12,9 +12,9 @@ class LogMessage(TypedDict):
class PubSubConnection(ABC):
def full_topic_name(self, prefix: str, topic_name: str) -> str:
def full_topic_name(self, prefix: str, *parts: str) -> str:
"""Return the full topic name for a given prefix and topic name."""
return f"{prefix}:{topic_name}"
return ":".join(map(str, [prefix, *parts]))
@abstractmethod
def iterate(self, prefix: str, topic_name: str, wait: bool) -> Iterator[Any]: