public List < CloudTrailSource > parseMessage ( List < Message > sqsMessages ) { List < CloudTrailSource > sources = new ArrayList <> ( ) ; for ( Message sqsMessage : sqsMessages ) { boolean parseMessageSuccess = false ; ProgressStatus parseMessageStatus = new ProgressStatus ( ProgressState . parseMessage , new BasicParseMessageInfo ( sqsMessage , parseMessageSuccess ) ) ; final Object reportObject = progressReporter . reportStart ( parseMessageStatus ) ; CloudTrailSource ctSource = null ; try { ctSource = sourceSerializer . getSource ( sqsMessage ) ; if ( containsCloudTrailLogs ( ctSource ) ) { sources . add ( ctSource ) ; parseMessageSuccess = true ; } } catch ( Exception e ) { LibraryUtils . handleException ( exceptionHandler , parseMessageStatus , e , "Failed to parse sqs message." ) ; } finally { if ( containsCloudTrailValidationMessage ( ctSource ) || shouldDeleteMessageUponFailure ( parseMessageSuccess ) ) { deleteMessageFromQueue ( sqsMessage , new ProgressStatus ( ProgressState . deleteMessage , new BasicParseMessageInfo ( sqsMessage , false ) ) ) ; } LibraryUtils . endToProcess ( progressReporter , parseMessageSuccess , parseMessageStatus , reportObject ) ; } } return sources ; }
Given a list of raw SQS message parse each of them and return a list of CloudTrailSource .