diff options
author | Subodh Ranadive <subodh.ranadive@ekzero.com> | 2021-03-19 23:45:56 +0530 |
---|---|---|
committer | Subodh Ranadive <subodh.ranadive@ekzero.com> | 2021-03-24 15:30:32 +0530 |
commit | 94f88fa74e6cdd198511eb0dbf574030869638d7 (patch) | |
tree | 8583a434d768b10bba3223d0ee220040770b2065 /src/main | |
parent | 31753a17d83d0db41e645f292f2a1cf9d7374694 (diff) | |
download | traccar-server-94f88fa74e6cdd198511eb0dbf574030869638d7.tar.gz traccar-server-94f88fa74e6cdd198511eb0dbf574030869638d7.tar.bz2 traccar-server-94f88fa74e6cdd198511eb0dbf574030869638d7.zip |
Review resolution
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/sms/SnsSmsClient.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/sms/SnsSmsClient.java b/src/main/java/org/traccar/sms/SnsSmsClient.java index cc7d09778..3b64852b5 100644 --- a/src/main/java/org/traccar/sms/SnsSmsClient.java +++ b/src/main/java/org/traccar/sms/SnsSmsClient.java @@ -40,19 +40,17 @@ public class SnsSmsClient implements SmsManager { if (Context.getConfig().hasKey(Keys.SMS_AWS_REGION) && Context.getConfig().hasKey(Keys.SMS_AWS_ACCESS) && Context.getConfig().hasKey(Keys.SMS_AWS_SECRET)) { - snsClient = awsSNSClient(); + BasicAWSCredentials awsCredentials = + new BasicAWSCredentials(Context.getConfig().getString(Keys.SMS_AWS_ACCESS), + Context.getConfig().getString(Keys.SMS_AWS_SECRET)); + snsClient = AmazonSNSAsyncClientBuilder.standard() + .withRegion(Context.getConfig().getString(Keys.SMS_AWS_REGION)) + .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build(); } else { throw new RuntimeException("SNS Not Configured Properly. Please provide valid config."); } } - public AmazonSNSAsync awsSNSClient() { - BasicAWSCredentials awsCredentials = new BasicAWSCredentials(Context.getConfig().getString(Keys.SMS_AWS_ACCESS), - Context.getConfig().getString(Keys.SMS_AWS_SECRET)); - return AmazonSNSAsyncClientBuilder.standard().withRegion(Context.getConfig().getString(Keys.SMS_AWS_REGION)) - .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build(); - } - @Override public void sendMessageSync(String destAddress, String message, boolean command) { Map<String, MessageAttributeValue> smsAttributes = new HashMap<>(); |