private static void Send(string subject, string msg) { Debug.WriteLine("Publish Orchestrator Topic: " + subject, "SimpleMessageConnect.Send"); var pubReq = new Amazon.SimpleNotificationService.Model.PublishRequest() .WithMessage(msg) .WithSubject(subject) .WithTopicArn(topicArn); Debug.WriteLine("TOPICARN: " + topicArn); var pubRsp = notification.Publish(pubReq); // CHECK PUBLISH RESULT if (!pubRsp.IsSetPublishResult()) { var s = String.Format("Failed to publish {0}, Message:{1} ", subject, msg); Debug.Fail(s); throw new PublishException(s); } }
public bool SendPersonUpdatedNotification(int personId, string message) { var topicArn = ConfigurationManager.AppSettings["AWSSNSTopicArn"]; var snsClient = new AmazonSimpleNotificationServiceClient(RegionEndpoint.USEast1); try { var publishRequest = new Amazon.SimpleNotificationService.Model.PublishRequest(); publishRequest.TopicArn = topicArn; publishRequest.Message = message; publishRequest.Subject = personId.ToString(); snsClient.Publish(publishRequest); return true; } catch (Exception ex) { // TODO Log exception return false; } }