use of org.finra.herd.service.impl.UploadDownloadServiceImpl.CompleteUploadSingleMessageResult in project herd by FINRAOS.
the class HerdJmsMessageListener method processS3Notification.
/**
* Process the message as S3 notification.
*
* @param payload the JMS message payload.
*
* @return boolean whether message was processed.
*/
private boolean processS3Notification(String payload) {
boolean messageProcessed = false;
try {
// Process messages coming from S3 bucket.
S3EventNotification s3EventNotification = S3EventNotification.parseJson(payload);
String objectKey = URLDecoder.decode(s3EventNotification.getRecords().get(0).getS3().getObject().getKey(), CharEncoding.UTF_8);
// Perform the complete upload single file.
CompleteUploadSingleMessageResult completeUploadSingleMessageResult = uploadDownloadService.performCompleteUploadSingleMessage(objectKey);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("completeUploadSingleMessageResult={}", jsonHelper.objectToJson(completeUploadSingleMessageResult));
}
messageProcessed = true;
} catch (RuntimeException | UnsupportedEncodingException e) {
// The logging is set to DEBUG level, since the method is expected to fail when message is not of the expected type.
LOGGER.debug("Failed to process message from the JMS queue for an S3 notification. jmsQueueName=\"{}\" jmsMessagePayload={}", HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING, payload, e);
}
return messageProcessed;
}
Aggregations