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; }
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; }
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); } }
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); } }
public void SendMessage(EAEPMessage message) { byte[] data = Encoding.UTF8.GetBytes(message.ToString()); _multicaster.Broadcast(data); }
private static byte[] EncodeMessage(EAEPMessage message) { return Encoding.UTF8.GetBytes(message.ToString()); }