Exemple #1
0
        private EAEPMessage ConstructMessage(string eventName, DateTime timestamp, IEnumerable<EventParameter> parameters)
        {
            var message = new EAEPMessage(timestamp, _host, _application, eventName);

            foreach(var parameter in parameters)
            {
                message[parameter.Name] = parameter.Value;
            }
            return message;
        }
Exemple #2
0
        private EAEPMessage BuildMessage()
        {
            EAEPMessage message = new EAEPMessage(hostBox.Text, appBox.Text, eventBox.Text);

            StringReader reader = new StringReader(paramsBox.Text);
            {
                while (reader.Peek() != -1)
                {
                    message.AddParamAVP(reader.ReadLine());
                }
            }
            return message;
        }
Exemple #3
0
 private void BroadcastMessage(EAEPMessage message)
 {
     try
     {
         var messageData = EncodeMessage(message);
         _multicastSender.Send(messageData);
     }
     catch(SocketException e)
     {
         _logger.Error(String.Format("message [{0}] cannot be sent", message), e);
     }
     catch(ObjectDisposedException e)
     {
         _logger.Error(String.Format("message [{0}] cannot be sent", message), e);
     }
 }
Exemple #4
0
        protected override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);

            if (Configuration.EAEPEnabled)
            {
                EAEPMessage message = new EAEPMessage(Environment.MachineName, Configuration.ApplicationName, "ActionExecuted");
                message["Controller"] = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
                message["Action"] = filterContext.ActionDescriptor.ActionName;

                if (filterContext.HttpContext.User.Identity.Name.Length > 0)
                {
                    message[EAEPMessage.PARAM_USER] = filterContext.HttpContext.User.Identity.Name;
                }

                IEAEPHttpClient client = new EAEPHttpClient(Configuration.EAEPHttpClientTimeout);
                client.SendMessage(Configuration.EAEPMonitorURI, message);
            }
        }
Exemple #5
0
 public void SendMessage(EAEPMessage message)
 {
     byte[] data = Encoding.UTF8.GetBytes(message.ToString());
     _multicaster.Broadcast(data);
 }
Exemple #6
0
 private static byte[] EncodeMessage(EAEPMessage message)
 {
     return Encoding.UTF8.GetBytes(message.ToString());
 }