aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/sms/SnsSmsClient.java14
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<>();