Esempio n. 1
0
 public void RemoveEventConsumer(MsEventController.EventConsumer ec)
 {
     //throw new NotImplementedException();
 }
        /// <summary>
        /// Writes a message to the Ipc event writer.
        /// </summary>
        /// <param name="message"></param>
        private void WriteMessage(MsEventController.NiawaEventMessageArgs message)
        {
            if (_ipcEventWriters.ContainsKey(message.ApplicationGroup))
            {
                Niawa.IpcController.iEventWriter writer = _ipcEventWriters[message.ApplicationGroup];
                //writer.Write(message.MessageType, "[" + message.ApplicationInstance + "] " + message.Message + " " + message.MessageDetail);

                Niawa.IpcController.IpcEvent evt = new Niawa.IpcController.IpcEvent();
                evt.EventID = Guid.NewGuid();
                evt.EventDate = System.DateTime.Now;
                evt.ApplicationName = message.ApplicationName;
                evt.ApplicationInstance = message.ApplicationInstance;
                evt.EventType = message.MessageType;
                evt.EventMessage = message.Message;
                evt.EventMessageDetail = message.MessageDetail;
                evt.NodeID = message.NodeID;
                evt.ParentNodeID = message.ParentNodeID;

                //if(message.ApplicationInstance.Trim().Length > 0) evt.AddProperty("instance", message.ApplicationInstance);
                //if(message.MessageDetail.Trim().Length > 0) evt.AddProperty("detail", message.MessageDetail);

                writer.Write(evt);

            }
            else
            {
                logger.Warn("[MsEventIpcEventAdapter] Could not find an event writer registered for [" + message.ApplicationGroup + "]; discarding message " + message.SerialID);
            }
        }