def handle_msg(self,<EOL>body,<EOL>org_message):
if os.path.exists(self.stop_for_file):<EOL><INDENT>log.info(("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>.format(self.stop_for_file))<EOL>org_message.requeue()<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>try:<EOL><INDENT>log.debug(("<STR_LIT>")<EOL>.format(ppj(body)))<EOL>msg = body<EOL>id = build_packet_key()<EOL>recv_time = rnow()<EOL>flat_msg = self.build_flat_msg(<EOL>id=id,<EOL>msg=msg)<EOL>if not flat_msg:<EOL><INDENT>log.error(("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>.format(msg))<EOL>return<EOL><DEDENT>msg["<STR_LIT:id>"] = id<EOL>msg["<STR_LIT>"] = recv_time<EOL>if len(flat_msg) > <NUM_LIT:0>:<EOL><INDENT>if self.debug:<EOL><INDENT>log.info(ppj(flat_msg))<EOL><DEDENT>flat_msg["<STR_LIT:id>"] = id<EOL>flat_msg["<STR_LIT>"] = recv_time<EOL>self.all_flat.append(flat_msg)<EOL>self.recv_msgs.append(msg)<EOL><DEDENT>already_saved = False<EOL>num_recv = len(self.recv_msgs)<EOL>if (num_recv % self.save_after_num) == <NUM_LIT:0>:<EOL><INDENT>already_saved = False<EOL>self.save_data()<EOL><DEDENT>if self.stop_after_num:<EOL><INDENT>if num_recv >= self.stop_after_num:<EOL><INDENT>if not already_saved:<EOL><INDENT>self.save_data()<EOL><DEDENT>log.info("<STR_LIT>")<EOL>sys.exit(<NUM_LIT:2>)<EOL><DEDENT><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>log.error(("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>.format(body,<EOL>e))<EOL><DEDENT>try:<EOL><INDENT>org_message.ack()<EOL><DEDENT>except Exception as e:<EOL><INDENT>log.error(("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>.format(body,<EOL>e))<EOL><DEDENT>log.info("<STR_LIT>")<EOL>
handle_msg

        :param body: dictionary contents from the message body
        :param org_message: message object can ack, requeue or reject