diff options
author | Subodh Ranadive <subodh.ranadive@ekzero.com> | 2021-03-09 12:53:52 +0530 |
---|---|---|
committer | Subodh Ranadive <subodh.ranadive@ekzero.com> | 2021-03-24 15:30:32 +0530 |
commit | 382237464a4c80bb4b5f05e05e77fedd61ab9f84 (patch) | |
tree | fefa857a0a9162ee0e6e1ee7836fcccdbddbdeea /src/main | |
parent | 5d43235b3d1fb967c8df269d2bdedb2164e726b2 (diff) | |
download | trackermap-server-382237464a4c80bb4b5f05e05e77fedd61ab9f84.tar.gz trackermap-server-382237464a4c80bb4b5f05e05e77fedd61ab9f84.tar.bz2 trackermap-server-382237464a4c80bb4b5f05e05e77fedd61ab9f84.zip |
Added Async call
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/sms/SnsSmsClient.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/sms/SnsSmsClient.java b/src/main/java/org/traccar/sms/SnsSmsClient.java index c2d568aa8..b4fbb8205 100644 --- a/src/main/java/org/traccar/sms/SnsSmsClient.java +++ b/src/main/java/org/traccar/sms/SnsSmsClient.java @@ -30,6 +30,7 @@ import org.traccar.notification.MessageException; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.CompletableFuture; public class SnsSmsClient implements SmsManager { private static final Logger LOGGER = LoggerFactory.getLogger(SnsSmsClient.class); @@ -54,8 +55,7 @@ public class SnsSmsClient implements SmsManager { } @Override - public void sendMessageSync(String destAddress, String message, boolean command) - throws InterruptedException, MessageException { + public void sendMessageSync(String destAddress, String message, boolean command) { Map<String, MessageAttributeValue> smsAttributes = new HashMap<>(); smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue().withStringValue("SNS").withDataType("String")); @@ -67,10 +67,6 @@ public class SnsSmsClient implements SmsManager { @Override public void sendMessageAsync(String destAddress, String message, boolean command) { - try { - sendMessageSync(destAddress, message, command); - } catch (InterruptedException | MessageException exception) { - LOGGER.warn("SMS send failed", exception.getMessage()); - } + new Thread(() -> sendMessageSync(destAddress, message, command)); } } |