Search code examples
javaamazon-web-servicesamazon-sns

Updating SMS sending result from AWS SNS Client


I send the SMS messages successfully with AWS SNS Client, based on this guide: here My problem is that I want to update the result of this message sending. I got the Message Id returned by the client and I store it in DB.

So my approach would be to create a scheduled job that would check my message sending results. Go through my database for messages that didn't have any result and query them from AWS. But I can't find any way to get the result from java code. I can check the metrics but that only gives me statistics results. I saw that there is a service called AWS Insight but I can't find any guide/docs about how to use it from the SDK. Maybe my approach is wrong, so I welcome any idea :)


Solution

  • There can be several options depends up which AWS resources you are using but not mentioned in the question or AWS resources which can help you to trace what you are looking for.

    With reference to current information in your question. Following are some of the options;

    1. Using Java SDK to query AWS CloudWatch as you mentioned in the question; a) Use AWSLogsClient.startQuery with your AWS CloudWatch insight query and keep note/store queryId. b) Use AWSLogsClient.getQueryResults using queryId from 1.a) to view AWS CloudWatch execution results.

    OR

    1. In case you are fine with SMS delivery updates per 24 hours. Then daily SMS usage csv format reports on AWS S3 is an option. Moreover, you can query these reports on AWS S3 or download report and extract information out of it as per your use-case.