From 204dfa7d84aaf30378d93b0c799ed6889c569475 Mon Sep 17 00:00:00 2001 From: "Hiroyasu.OHYAMA" Date: Mon, 29 Aug 2016 11:24:51 +0900 Subject: [PATCH] [kafka] invoke TypeError exception when 'listen()' method of KafkaDriver is called The interface of BaseDriver which is a super-class of each underlying transport driver has been changed. But the interface of kafka driver doens't follow up this change. So if a user chose it as a transport driver, an exception of TypeError would be occurred. This change corrects the interface in kafka's driver along with the BaseDriver's one. Change-Id: Iedd069b7f083e2cbf377f4148411f77ad758f979 Closes-Bug: #1616755 --- oslo_messaging/_drivers/impl_kafka.py | 2 +- oslo_messaging/tests/drivers/test_impl_kafka.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/oslo_messaging/_drivers/impl_kafka.py b/oslo_messaging/_drivers/impl_kafka.py index b448fcdbb..aa060eedc 100644 --- a/oslo_messaging/_drivers/impl_kafka.py +++ b/oslo_messaging/_drivers/impl_kafka.py @@ -347,7 +347,7 @@ class KafkaDriver(base.BaseDriver): with self._get_connection(purpose=PURPOSE_SEND) as conn: conn.notify_send(target_to_topic(target), ctxt, message, retry) - def listen(self, target): + def listen(self, target, batch_size, batch_timeout): raise NotImplementedError( 'The RPC implementation for Kafka is not implemented') diff --git a/oslo_messaging/tests/drivers/test_impl_kafka.py b/oslo_messaging/tests/drivers/test_impl_kafka.py index 4579453a7..33c45d9bd 100644 --- a/oslo_messaging/tests/drivers/test_impl_kafka.py +++ b/oslo_messaging/tests/drivers/test_impl_kafka.py @@ -108,7 +108,8 @@ class TestKafkaDriver(test_utils.BaseTestCase): def test_listen(self): target = oslo_messaging.Target(topic="topic_test") - self.assertRaises(NotImplementedError, self.driver.listen, target) + self.assertRaises(NotImplementedError, self.driver.listen, target, + None, None) class TestKafkaConnection(test_utils.BaseTestCase):