Skip to content

Instantly share code, notes, and snippets.

@anacrolix
Created November 20, 2019 05:26
Show Gist options
  • Save anacrolix/ef9d60ce52c1f15097ff952213481768 to your computer and use it in GitHub Desktop.
Save anacrolix/ef9d60ce52c1f15097ff952213481768 to your computer and use it in GitHub Desktop.
use of handle!
let result = handle!(result, err, {
error!("error receiving messages: {}", err);
continue;
});
trace!("got message result");
for msg in result.messages.unwrap_or_default() {
let body = msg.body.unwrap();
let _delete = sqs
.delete_message(rusoto_sqs::DeleteMessageRequest {
queue_url: queue_url.to_owned(),
receipt_handle: msg.receipt_handle.unwrap(),
})
.sync();
debug!("got message: {:#?}", body);
let records = handle!(get_records(body), err, {
warn!("error getting records: {}", err);
continue;
});
for r in records {
let event = handle!(parse_record(r), err, {
error!("parsing record: {}", err);
continue;
});
handle!(handle_event(&event, index), err, {
error!("error handling event {:?}: {}", event, err);
continue;
});
info!("handled {:?}", event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment