def _ProcessMessageHandlerRequests(self, requests):
    """Processes message handler requests."""
    logging.debug("Leased message handler request ids: %s",
                  ",".join(str(r.request_id) for r in requests))
    grouped_requests = collection.Group(requests, lambda r: r.handler_name)
    for handler_name, requests_for_handler in iteritems(grouped_requests):
      handler_cls = handler_registry.handler_name_map.get(handler_name)
      if not handler_cls:
        logging.error("Unknown message handler: %s", handler_name)
        continue

      stats_collector_instance.Get().IncrementCounter(
          "well_known_flow_requests", fields=[handler_name])

      try:
        logging.debug("Running %d messages for handler %s",
                      len(requests_for_handler), handler_name)
        handler_cls(token=self.token).ProcessMessages(requests_for_handler)
      except Exception as e:  # pylint: disable=broad-except
        logging.exception("Exception while processing message handler %s: %s",
                          handler_name, e)

    logging.debug("Deleting message handler request ids: %s",
                  ",".join(str(r.request_id) for r in requests))
    data_store.REL_DB.DeleteMessageHandlerRequests(requests)
def _ProcessMessageHandlerRequests ( self , requests ) : logging . debug ( "Leased message handler request ids: %s" , "," . join ( str ( r . request_id ) for r in requests ) ) grouped_requests = collection . Group ( requests , lambda r : r . handler_name ) for handler_name , requests_for_handler in iteritems ( grouped_requests ) : handler_cls = handler_registry . handler_name_map . get ( handler_name ) if not handler_cls : logging . error ( "Unknown message handler: %s" , handler_name ) continue stats_collector_instance . Get ( ) . IncrementCounter ( "well_known_flow_requests" , fields = [ handler_name ] ) try : logging . debug ( "Running %d messages for handler %s" , len ( requests_for_handler ) , handler_name ) handler_cls ( token = self . token ) . ProcessMessages ( requests_for_handler ) except Exception as e : logging . exception ( "Exception while processing message handler %s: %s" , handler_name , e ) logging . debug ( "Deleting message handler request ids: %s" , "," . join ( str ( r . request_id ) for r in requests ) ) data_store . REL_DB . DeleteMessageHandlerRequests ( requests )
Processes message handler requests.