public static void PublishNotifications(AsimovEvent evt)
 {
     foreach (var publisher in Publishers)
     {
         publisher.Notify(evt);
     }
 }
Exemplo n.º 2
0
        public void Notify(AsimovEvent evt)
        {
            try
            {
                if (string.IsNullOrEmpty(_webNotificationUrl))
                {
                    return;
                }

                var url = new Uri(_webNotificationUrl);

                var request = WebRequest.Create(url) as HttpWebRequest;
                request.Method      = "POST";
                request.ContentType = "application/json";
                request.ServicePoint.Expect100Continue = false;
                request.Timeout = 30000;

                using (var requestStream = request.GetRequestStream())
                {
                    using (var writer = new StreamWriter(requestStream))
                    {
                        var serializer = new JsonSerializer {
                            NullValueHandling = NullValueHandling.Ignore
                        };
                        serializer.Serialize(writer, evt);
                    }
                }

                using (var resp = request.GetResponse())
                {
                    resp.Close();
                }
            }
            catch (Exception)
            {
                Console.Write("Error sending event from webnotification publisher");
            }
        }
        public void Notify(string url, AsimovEvent evt)
        {
            var nodeFront = ObjectFactory.GetInstance <INodeFrontPublisher>();

            nodeFront.Notify(url, evt);
        }
 public void Notify(AsimovEvent evt)
 {
     Notify("/agent/event", evt);
 }
Exemplo n.º 5
0
 public void Notify(AsimovEvent data)
 {
     LastEvent   = data;
     WasNotified = true;
 }
 public void Notify(AsimovEvent data)
 {
     WasNotified = true;
 }