Skip to content

Instantly share code, notes, and snippets.

@lmeadors
Created September 19, 2013 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmeadors/6628268 to your computer and use it in GitHub Desktop.
Save lmeadors/6628268 to your computer and use it in GitHub Desktop.
public void deleteTitlesFromCloudSearch(List<AmazonSearchDataFormat> amazonSearchRecords) {
logger.debug("Deleting {} titles from CloudSearch", amazonSearchRecords.size());
if (amazonSearchRecords.isEmpty()) return;
try {
postBatchToCloudSearch(cloudSearchTitlesEndpoint, amazonSearchRecords);
for (AmazonSearchDataFormat amazonSearchDataFormat : amazonSearchRecords) {
searchableContentMapper.removeDeleted(Integer.valueOf(amazonSearchDataFormat.getId()));
}
amazonCloudWatchAsyncClient.putMetricDataAsync(
new PutMetricDataRequest()
.withNamespace("Hoopla/Integration")
.withMetricData(new MetricDatum()
.withMetricName("CloudSearchTitles-DELETE-" + environment)
.withValue((double) amazonSearchRecords.size())
)
);
} catch (IOException e) {
logger.error("Exception while trying to post a DELETE batch to CloudSearch", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment