From 94f88fa74e6cdd198511eb0dbf574030869638d7 Mon Sep 17 00:00:00 2001 From: Subodh Ranadive Date: Fri, 19 Mar 2021 23:45:56 +0530 Subject: Review resolution --- src/main/java/org/traccar/sms/SnsSmsClient.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/main/java/org/traccar/sms/SnsSmsClient.java') 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 smsAttributes = new HashMap<>(); -- cgit v1.2.3