You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/11/30 21:00:08 UTC

[incubator-openwhisk-package-kafka] branch master updated: verify trigger fire responds with any successful status code (#229)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-kafka.git


The following commit(s) were added to refs/heads/master by this push:
     new fee695a  verify trigger fire responds with any successful status code (#229)
fee695a is described below

commit fee695ab1cd0669a6faae7ffcc8d0002d72ed440
Author: Adnan Baruni <ab...@users.noreply.github.com>
AuthorDate: Thu Nov 30 15:00:04 2017 -0600

    verify trigger fire responds with any successful status code (#229)
    
    * verify trigger fire responds with any successful status code, not just 200
    
    * only log activation id if response contains it
    
    * whitespace
    
    * logging
---
 provider/consumer.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/provider/consumer.py b/provider/consumer.py
index b3af4b4..f28c524 100644
--- a/provider/consumer.py
+++ b/provider/consumer.py
@@ -353,8 +353,12 @@ class ConsumerProcess (Process):
 
                     # Manually commit offset if the trigger was fired successfully. Retry firing the trigger
                     # for a select set of status codes
-                    if status_code == 200:
-                        logging.info("[{}] Fired trigger with activation {}".format(self.trigger, response.json()['activationId']))
+                    if status_code in range(200, 300):
+                        response_json = response.json()
+                        if 'activationId' in response_json and response_json['activationId'] is not None:
+                            logging.info("[{}] Fired trigger with activation {}".format(self.trigger, response_json['activationId']))
+                        else:
+                            logging.info("[{}] Successfully fired trigger".format(self.trigger))
                         # the consumer may have consumed messages that did not make it into the messages array.
                         # be sure to only commit to the messages that were actually fired.
                         self.consumer.commit(offsets=self.__getOffsetList(messages), async=False)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].