Skip to content

Commit

Permalink
Fix bug on MNS receipt_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyang committed Aug 1, 2017
1 parent a696eb6 commit 1cce971
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mns/mns_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def send_message(self, req, resp):
resp.header = resp_inter.header
self.check_status(req_inter, resp_inter, resp)
if resp.error_data == "":
resp.message_id, resp.message_body_md5 = SendMessageDecoder.decode(resp_inter.data, req_inter.get_req_id())
resp.message_id, resp.message_body_md5, resp.receipt_handle = SendMessageDecoder.decode(resp_inter.data, req_inter.get_req_id())
if self.logger:
self.logger.info("SendMessage RequestId:%s QueueName:%s Priority:%s DelaySeconds:%s MessageId:%s MessageBodyMD5:%s" % \
(resp.get_requestid(), req.queue_name, req.priority, \
Expand Down
4 changes: 2 additions & 2 deletions mns/mns_xml_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ class SendMessageDecoder(DecoderBase):
def decode(xml_data, req_id=None):
data_dic = {}
DecoderBase.xml_to_dic("Message", xml_data, data_dic, req_id)
key_list = ["MessageId", "MessageBodyMD5"]
key_list = ["MessageId", "MessageBodyMD5", "ReceiptHandle"]
for key in key_list:
if key not in data_dic.keys():
raise MNSClientNetworkException("RespDataDamaged", xml_data, req_id)
return data_dic["MessageId"], data_dic["MessageBodyMD5"]
return data_dic["MessageId"], data_dic["MessageBodyMD5"], data_dic["ReceiptHandle"]

class BatchSendMessageDecoder(DecoderBase):
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions mns/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def __send_resp2msg__(self, resp):
msg = Message()
msg.message_id = resp.message_id
msg.message_body_md5 = resp.message_body_md5
msg.receipt_handle = resp.receipt_handle
return msg

def __batchsend_resp2msg__(self, resp):
Expand Down

0 comments on commit 1cce971

Please sign in to comment.