You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ubuntu
Linux b589473f479b 4.9.49-moby #1 SMP Wed Sep 27 00:36:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
What compiler are you using? what version?
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
What's your CMake arguments?
cmake -DBUILD_ONLY="s3;sqs;monitoring"
Can you provide a TRACE level log? (sanitize any sensitive information)
Questions
Currently, I am trying to get the failed batchrequestentry
bool SendMessageBatch(const std::string & sqs_url, const std::vector<std::string> &msgs)
{
bool res=true;
for (size_t i=0;i<msgs.size();i+=10)
{
auto send_request = Aws::SQS::Model::SendMessageBatchRequest().WithQueueUrl(sqs_url.c_str());
size_t j=i;
for(; j<std::min(i+10,msgs.size()); ++j){
Aws::SQS::Model::SendMessageBatchRequestEntry entry;
entry.SetId(std::to_string(j+1).c_str());
entry.SetMessageBody(msgs[j].c_str());
send_request.AddEntries(entry);
}
if (j > i){
auto batch_outcome = m_sqs_client.SendMessageBatch(send_request);
if (!batch_outcome.IsSuccess()){
if (!batch_outcome.GetResult().GetFailed().empty()){
for ( auto &fail_msg_entry : batch_outcome.GetResult().GetFailed()){
auto msg_id_str = fail_msg_entry.GetId();
auto it = std::find_if(send_request.GetEntries().begin(), send_request.GetEntries().end(),
[&msg_id_str](const Aws::SQS::Model::SendMessageBatchRequestEntry& msg_entry) {return msg_entry.GetId() == msg_id_str;});
// find and try again
if(it!=send_request.GetEntries().end()) res &= SendMessage(sqs_url, it->GetMessageBody().c_str());
}
}
}
}
}
return res;
}
batch_outcome.GetResult().GetFailed() always be empty, even thogh the call is not successful, I definitely know there should be some failed messages.
What's the correct way to get the failed BatchRequestEntry ?
Thanks!
The text was updated successfully, but these errors were encountered:
Tanych
changed the title
Correct way to Get the Failed BatchRequestEntry when call SendMessageBatchRequest
Correct way to Get the Failed BatchRequestEntry when call SendMessageBatch
Sep 12, 2018
I think you misunderstood the meaning of IsSuccess(). It's about the status of the request in SDK level, not the high level status of service response. If IsSuccess() == false you should only call GetError() to investigate. If you want to call outcome.GetResult().GetFailed(), IsSuccess() must return true, means service returned response correctly, then you can look up if there is FAILED sqs request in the response.
Because the batch request can result in a combination of successful and
unsuccessful actions, you should check for batch errors even when the
call returns an HTTP status code of 200
it means IsSuccess() is the same level of http 200, right?
What platform/OS are you using?
Ubuntu
Linux b589473f479b 4.9.49-moby #1 SMP Wed Sep 27 00:36:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
What compiler are you using? what version?
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
What's your CMake arguments?
cmake -DBUILD_ONLY="s3;sqs;monitoring"
Can you provide a TRACE level log? (sanitize any sensitive information)
Questions
Currently, I am trying to get the failed batchrequestentry
batch_outcome.GetResult().GetFailed() always be empty, even thogh the call is not successful, I definitely know there should be some failed messages.
What's the correct way to get the failed BatchRequestEntry ?
Thanks!
The text was updated successfully, but these errors were encountered: