Пример #1
0
 def processed(self, body, message):
     try:
         payload = json.loads(body)
         if 'message' in payload:
             if 'zone' not in payload:
                 payload['zone'] = 'all'
     except Exception, exc:
         logger.error('Consumer raised exception: {exception}'.format(exception=exc))
Пример #2
0
 def to_process(self, body, message):
     try:
         payload = json.loads(body)
         if 'message' in payload:
             if 'zone' not in payload:
                 payload['zone'] = 'all'
         logger.debug('[ZONE - {zone}] Received sentence: {sentence}'.format(
             sentence=payload.get('message'),
             zone=payload.get('zone')
         ))
         answer = self.mgr.driver.process_sentence(sentence=payload.get('message'))
         logger.debug('Answer from LISA API : {answer}'.format(answer=answer))
     except Exception, exc:
         logger.error('Consumer raised exception: {exception}'.format(exception=exc))