private void SendNotificationAsync(NotificationTemplate template, IList <SNSEndpoint> endpoints, SNSType type, string url = null) { Parallel.ForEach(endpoints, endpoint => { new Thread(() => { SNSMessage message = new SNSMessage(template, endpoint.SNSToken, type, url); var jsonObj = message.GetNotificationJson(); SendNotification(jsonObj, endpoint, 3); }).Start(); }); }
private static bool TryGetSNSMessage(string messageBody, bool unpackSNS, out SNSMessage snsMessage) { if (unpackSNS) { try { snsMessage = JsonConvert.DeserializeObject <SNSMessage>(messageBody); if (snsMessage.TopicARN != null && snsMessage.TopicARN.StartsWith("arn:")) { return(true); } } catch { } } snsMessage = null; return(false); }