use of org.finra.herd.model.dto.AwsParamsDto in project herd by FINRAOS.
the class StoragePolicySelectorServiceImpl method sendStoragePolicySelectionToSqsQueue.
/**
* Sends storage policy selections to the specified AWS SQS queue.
*
* @param sqsQueueName the SQS queue name to send storage policy selections to
* @param storagePolicySelections the list of storage policy selections
*/
private void sendStoragePolicySelectionToSqsQueue(String sqsQueueName, List<StoragePolicySelection> storagePolicySelections) {
if (CollectionUtils.isNotEmpty(storagePolicySelections)) {
AwsParamsDto awsParamsDto = awsHelper.getAwsParamsDto();
for (StoragePolicySelection storagePolicySelection : storagePolicySelections) {
String messageText = null;
try {
messageText = jsonHelper.objectToJson(storagePolicySelection);
sqsDao.sendMessage(awsParamsDto, sqsQueueName, messageText, null);
} catch (Exception e) {
// Log the error and throw the exception up.
LOGGER.error("Failed to publish message to the JMS queue. jmsQueueName=\"{}\" jmsMessagePayload={}", sqsQueueName, messageText);
throw new IllegalStateException(e.getMessage(), e);
}
}
}
}
use of org.finra.herd.model.dto.AwsParamsDto in project herd by FINRAOS.
the class UploadDownloadHelperServiceImpl method deleteSourceS3ObjectAfterError.
/**
* Deletes a source S3 object based on the given bucket name and file path.
*
* @param s3BucketName the S3 bucket name
* @param storageFilePath the storage file path
* @param businessObjectDataKey the business object key
*/
private void deleteSourceS3ObjectAfterError(String s3BucketName, String storageFilePath, BusinessObjectDataKey businessObjectDataKey) {
// Delete the file from S3 if storage file information exists.
if (!StringUtils.isEmpty(storageFilePath)) {
try {
// Delete the source file from S3.
AwsParamsDto awsParams = awsHelper.getAwsParamsDto();
S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = S3FileTransferRequestParamsDto.builder().withS3BucketName(s3BucketName).withS3KeyPrefix(storageFilePath).withHttpProxyHost(awsParams.getHttpProxyHost()).withHttpProxyPort(awsParams.getHttpProxyPort()).build();
s3Dao.deleteDirectory(s3FileTransferRequestParamsDto);
} catch (Exception e) {
LOGGER.error("Failed to delete source business object data file. s3Key=\"{}\" sourceS3BucketName=\"{}\" sourceBusinessObjectDataKey={}", storageFilePath, s3BucketName, jsonHelper.objectToJson(businessObjectDataKey), e);
}
}
}
Aggregations