Exemplo n.º 1
0
 def check_duplicate_message(self, message_data):
     """AMQP consumers may read same message twice when exceptions occur
        before ack is returned. This method prevents doing it.
     """
     if UNIQUE_ID in message_data:
         msg_id = message_data.pop(UNIQUE_ID)
         if msg_id not in self.prev_msgids:
             self.prev_msgids.append(msg_id)
         else:
             raise rpc_common.DuplicateMessageError(msg_id=msg_id)
Exemplo n.º 2
0
 def check_duplicate_message(self, message_data):
     """AMQP consumers may read same message twice when exceptions occur
        before ack is returned. This method prevents doing it.
     """
     try:
         msg_id = message_data.pop(UNIQUE_ID)
     except KeyError:
         return
     if msg_id in self.prev_msgids:
         raise rpc_common.DuplicateMessageError(msg_id=msg_id)
     return msg_id