diff --git a/faust/agents/replies.py b/faust/agents/replies.py index b4e4247c8..59233fb29 100644 --- a/faust/agents/replies.py +++ b/faust/agents/replies.py @@ -189,7 +189,7 @@ def _reply_topic(self, topic: str) -> TopicT: return self.app.topic( topic, partitions=1, - replicas=0, + replicas=self.app.conf.topic_replication_factor, deleting=True, retention=self.app.conf.reply_expires, value_type=ReqRepResponse, diff --git a/tests/unit/agents/test_replies.py b/tests/unit/agents/test_replies.py index 36628d9c0..cbc6d0bb9 100644 --- a/tests/unit/agents/test_replies.py +++ b/tests/unit/agents/test_replies.py @@ -254,7 +254,12 @@ def test_reply_topic(self, *, c, app): topic = c._reply_topic("foo") assert topic.get_topic_name() == "foo" assert topic.partitions == 1 - assert topic.replicas == 0 + # Must not hardcode 0: most brokers reject a replication factor of + # 0 outright (InvalidReplicationFactorError, see + # faust-streaming/faust#76). Use the app's configured default + # instead, consistent with every other topic faust creates. + assert topic.replicas == app.conf.topic_replication_factor + assert topic.replicas > 0 assert topic.deleting assert topic.retention == app.conf.reply_expires assert topic.value_type is ReqRepResponse