dubeejw closed pull request #243: remove assumption that partitions will be 
non-empty when passed into callbacks
URL: https://github.com/apache/incubator-openwhisk-package-kafka/pull/243
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/provider/consumer.py b/provider/consumer.py
index 4728d27..5d2d2b4 100644
--- a/provider/consumer.py
+++ b/provider/consumer.py
@@ -481,21 +481,20 @@ def __encodeKeyIfNeeded(self, key):
         return key
 
     def __error_callback(self, error):
-        logging.warning(error)
+        logging.warning('[{}] {}'.format(self.trigger, error))
         if not self.connected and error.code() == KafkaError._AUTHENTICATION:
             self.authErrors = self.authErrors + 1
             if self.authErrors > self.maxAuthErrors:
+                logging.warning('[{}] Shutting down consumer and disabling 
trigger. Exceeded the allowable number of _AUTHENTICATION 
errors'.format(self.trigger))
                 self.setDesiredState(Consumer.State.Disabled)
                 message = 'Automatically disabled trigger. Consumer failed to 
authenticate with broker(s) after more than 30 attempts with apikey 
{}:{}'.format(self.username, self.password)
                 self.database.disableTrigger(self.trigger, 403, message)
 
     def __on_assign(self, consumer, partitions):
-        topicPartition = partitions[0]
-        logging.info('[{}] Completed partition assignment. topic: {}, 
partition: {}, offset: {}'.format(self.trigger, topicPartition.topic, 
topicPartition.partition, topicPartition.offset))
+        logging.info('[{}] Completed partition assignment. Connected to 
broker(s)'.format(self.trigger))
         self.authErrors = 0
         self.connected = True
 
     def __on_revoke(self, consumer, partitions):
-        topicPartition = partitions[0]
-        logging.info('[{}] Partition assignment has been revoked. topic: {}, 
partition: {}, offset: {}'.format(self.trigger, topicPartition.topic, 
topicPartition.partition, topicPartition.offset))
+        logging.info('[{}] Partition assignment has been revoked. Disconnected 
from broker(s)'.format(self.trigger))
         self.connected = False


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to