/// <summary> /// Send local shared dll for the sync to the partner request /// </summary> /// <param name="Partner">Partner request to send</param> public static void SyncSendLocalDLLList(string DestinationPartner) { try { EventsEngine.UpdateAssemblyEventListShared(); foreach (var jitgAssemblyEvent in EventsEngine.AssemblyEventListShared) { LogEngine.ConsoleWriteLine( string.Format("SENT EVENT - {0} to {1}", jitgAssemblyEvent.FileName, DestinationPartner), ConsoleColor.Green); OffRampEngineSending.SendMessageOnRamp(jitgAssemblyEvent, Configuration.MessageDataProperty.SyncSendLocalDLL, DestinationPartner, null); } } catch (InvalidOperationException eoe) { LogEngine.ConsoleWriteLine( string.Format("Syncronization and Dictionaries rebuilded, Excpetion controlled - {0}", eoe.HResult), ConsoleColor.DarkRed); } catch (Exception ex) { LogEngine.WriteLog(Configuration.General_Source, string.Format("Error in {0}", MethodBase.GetCurrentMethod().Name), Constant.Error_EventID_High_Critical_, Constant.TaskCategories_, ex, EventLogEntryType.Error); } }
/// <summary> /// Execute an embedded trigger /// </summary> /// <param name="componeId"> /// </param> /// <param name="triggerEmbeddedBag"></param> /// <returns> /// The <see cref="string" />. /// </returns> public static byte[] ExecuteEmbeddedTrigger(TriggerEmbeddedBag triggerEmbeddedBag) { try { eventStop = new AutoResetEvent(false); SyncAsyncEventAction = SyncAsyncActionReceived; triggerEmbeddedBag.ActionContext.BubblingObjectBag.SyncronousToken = Guid.NewGuid().ToString(); EventsEngine.SyncAsyncEventsAddDelegate( triggerEmbeddedBag.ActionContext.BubblingObjectBag.SyncronousToken, SyncAsyncActionReceived); EventsEngine.EngineExecuteEmbeddedTrigger(triggerEmbeddedBag); eventStop.WaitOne(); return(_syncronousDataContext); } catch (Exception ex) { LogEngine.WriteLog( ConfigurationBag.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.LogLevelError, Constant.TaskCategoriesError, ex, Constant.LogLevelError); return(null); } }
/// <summary> /// Load the bubbling settings /// </summary> public static void InitializeOffRampEmbedded(SetEventActionEvent delegateActionEventEmbedded) { //Load Configuration GrabCaster.Framework.Base.Configuration.LoadConfiguration(); LogEngine.EventViewerWriteLog(Configuration.EngineName, "Inizialize Off Ramp embedded messaging.", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Information); //Solve App domain environment var current = AppDomain.CurrentDomain; current.AssemblyResolve += HandleAssemblyResolve; int triggers = 0; int events = 0; EventsEngine.InitializeTriggerEngine(); EventsEngine.InitializeEmbeddedEvent(delegateActionEventEmbedded); //Load component list configuration EventsEngine.LoadBubblingEventList(ref triggers, ref events); //Load event list configuration EventsEngine.RefreshBubblingSetting(); }
/// <summary> /// Load the bubbling settings /// </summary> public static void InitializeOffRampEmbedded(ActionEvent delegateEmbedded) { //Load Configuration ConfigurationBag.LoadConfiguration(); LogEngine.WriteLog(ConfigurationBag.EngineName, "Inizialize Off Ramp embedded messaging.", Constant.LogLevelError, Constant.TaskCategoriesError, null, Constant.LogLevelInformation); //Solve App domain environment var current = AppDomain.CurrentDomain; current.AssemblyResolve += HandleAssemblyResolve; int triggers = 0; int events = 0; int components = 0; EventsEngine.InitializeTriggerEngine(); EventsEngine.InitializeEmbeddedEvent(delegateEmbedded); //Load component list configuration EventsEngine.LoadAssemblyComponents(ref triggers, ref events, ref components); //Load event list configuration EventsEngine.RefreshBubblingSetting(false); }
//http://localhost:8000/GrabCaster/Sync public string Sync() { if (EventsEngine.SyncronizePoint()) { return($"Syncronization completed. - {DateTime.Now}"); } return("Point syncronization failed with errors, check the event viewer and the log."); }
private static IEngine CreateEngine() { var factory = new EventsFactory(typeof(Event)); var events = new EventsManager(factory); var logger = new MessageLogger(); var engine = new EventsEngine(logger, events); return(engine); }
/// <summary> /// Initialize an embedded trigger /// </summary> /// <param name="componeId"> /// </param> /// <param name="configurationId"></param> /// <param name="componentId"></param> /// <returns> /// The <see cref="string" />. /// </returns> public static TriggerEmbeddedBag InitializeEmbeddedTrigger(string configurationId, string componentId) { try { return(EventsEngine.InitializeEmbeddedTrigger(configurationId, componentId)); } catch (Exception ex) { LogEngine.WriteLog( ConfigurationBag.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.LogLevelError, Constant.TaskCategoriesError, ex, Constant.LogLevelError); return(null); } }
protected override void Initialize() { Components.Add(EventsEngine = new EventsEngine(this)); Components.Add(InputMonitor = new InputMonitor(this)); Components.Add(DebugMonitor = new DebugMonitor(this, 60) { Visible = Program.Debug }); InputMonitor.KeyReleased += keys => { if (keys == Keys.F1) { DebugMonitor.Visible = !DebugMonitor.Visible; } //else if (keys == Keys.F11) Graphics.ToggleFullScreen(); }; ContentEngine.GlobalContent.LoadContent(); base.Initialize(); }
/// <summary> /// Execute an internal trigger /// </summary> /// <param name="triggerId"> /// </param> /// <param name="configurationId"></param> /// <returns> /// The <see cref="string"/>. /// </returns> /// http://localhost:8000/GrabCaster/ExecuteTrigger?ConfigurationID={3C62B951-C353-4899-8670-C6687B6EAEFC}TriggerID={3C62B951-C353-4899-8670-C6687B6EAEFC}&value=text public string ExecuteTrigger(string configurationId, string triggerId, string value) { try { var executed = false; try { var triggerSingleInstance = (from trigger in EventsEngine.BubblingTriggerConfigurationsSingleInstance where trigger.IdComponent == triggerId && trigger.IdConfiguration == configurationId select trigger).First(); var bubblingTriggerConfiguration = triggerSingleInstance; byte[] content = Encoding.UTF8.GetBytes(value); EventsEngine.ExecuteTriggerConfiguration(bubblingTriggerConfiguration, content); executed = true; } catch { // ignored } try { var triggerPollingInstance = (from trigger in EventsEngine.BubblingTriggerConfigurationsPolling where trigger.IdComponent == triggerId && trigger.IdConfiguration == configurationId select trigger).First(); var bubblingTriggerConfiguration = triggerPollingInstance; byte[] content = Encoding.UTF8.GetBytes(value); EventsEngine.ExecuteTriggerConfiguration(bubblingTriggerConfiguration, content); executed = true; } catch { // ignored } return(executed ? "Trigger executed." : "Trigger not executed check the Windows event viewer."); } catch (Exception ex) { return($"Error - {ex.Message} "); } }
/// <summary> /// Send local shared dll for the sync to the partner request /// </summary> /// <param name="Partner">Partner request to send</param> public static void SyncSendLocalDLL(AssemblyEvent jitgAssemblyEvent, string DestinationPartner) { try { EventsEngine.UpdateAssemblyEventListShared(); LogEngine.ConsoleWriteLine( string.Format("SENT EVENT - {0} to {1}", jitgAssemblyEvent.FileName, DestinationPartner), ConsoleColor.Green); OffRampEngineSending.SendMessageOnRamp(jitgAssemblyEvent, Configuration.MessageDataProperty.SyncSendLocalDLL, DestinationPartner, null); } catch (Exception ex) { LogEngine.WriteLog(Configuration.General_Source, string.Format("Error in {0}", MethodBase.GetCurrentMethod().Name), Constant.Error_EventID_High_Critical_, Constant.TaskCategories_, ex, EventLogEntryType.Error); } }
/// <summary> /// Execute an internal trigger /// </summary> /// <param name="triggerId"> /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> /// http://localhost:8000/GrabCaster/ExecuteTrigger?TriggerID={3C62B951-C353-4899-8670-C6687B6EAEFC} public static bool ExecuteTrigger(string configurationId, string triggerId, byte[] data) { try { var triggerSingleInstance = (from trigger in EventsEngine.BubblingTriggerConfigurationsSingleInstance where trigger.IdComponent == triggerId && trigger.IdConfiguration == configurationId select trigger).First(); EventsEngine.ExecuteTriggerConfiguration(triggerSingleInstance, data); return(true); } catch (Exception ex) { LogEngine.EventViewerWriteLog( Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name} - The trigger ID {triggerId} does not exist.", Constant.DefconOne, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); return(false); } }
/// <summary> /// Execute an internal trigger /// </summary> /// <param name="triggerId"> /// </param> /// <param name="configurationId"></param> /// <returns> /// The <see cref="string" />. /// </returns> /// http://localhost:8000/GrabCaster/ExecuteTrigger?ConfigurationID={5D793BC4-B111-4BF4-BAAF-196F661E13E2}&TriggerID={9A989BD1-C8DE-4FC1-B4BA-02E7D8A4AD76}&value=text public string ExecuteTrigger(string configurationId, string triggerId, string value) { try { var BubblingObjects = (from trigger in EventsEngine.BubblingTriggerConfigurationsSingleInstance where trigger.IdComponent == triggerId && trigger.IdConfiguration == (configurationId ?? "") select trigger).ToArray(); if (BubblingObjects.Length != 0) { byte[] content = EncodingDecoding.EncodingString2Bytes(value ?? ""); EventsEngine.ExecuteTriggerConfiguration(BubblingObjects[0], content); return("Trigger executed."); } return ($"Trigger not found. - Looking for Trigger Id {triggerId} and configuration Id {configurationId}."); } catch (Exception ex) { return ($"Trigger not executed check the Windows event viewer and check the trigger Id and configuration Id are present and active in the trigger folder - Looking for Trigger Id {triggerId} and configuration Id {configurationId} - Exception {ex.Message}."); } }
public static void IngestMessagge(BubblingObject bubblingObject) { try { LogEngine.WriteLog(ConfigurationBag.EngineName, $"IngestMessagge bubblingObject.SenderChannelId {bubblingObject.SenderChannelId} " + $"bubblingObject.SenderPointId {bubblingObject.SenderPointId} " + $"bubblingObject.DestinationChannelId {bubblingObject.DestinationChannelId} " + $" bubblingObject.DestinationPointId {bubblingObject.DestinationPointId} " + $"bubblingObject.MessageType {bubblingObject.MessageType}" + $"bubblingObject.Persisting {bubblingObject.Persisting} " + $"bubblingObject.MessageId {bubblingObject.MessageId} " + $"bubblingObject.Name {bubblingObject.Name}", Constant.LogLevelError, Constant.TaskCategoriesConsole, null, Constant.LogLevelVerbose); //If local event then execute if (bubblingObject.LocalEvent) { //new Task(() => //{ // EventsEngine.ExecuteEventsInTrigger( // bubblingObject, // bubblingObject.Events[0], // false, // bubblingObject.SenderPointId); //}).Start(); EventsEngine.ExecuteEventsInTrigger( bubblingObject, bubblingObject.Events[0], false, bubblingObject.SenderPointId); return; } //Check if message is for this point var receiverChannelId = bubblingObject.DestinationChannelId; var receiverPointId = bubblingObject.DestinationPointId; var requestAvailable = (receiverChannelId == ConfigurationBag.Configuration.ChannelId && receiverPointId == ConfigurationBag.Configuration.PointId) || (receiverChannelId == ConfigurationBag.ChannelAll && receiverPointId == ConfigurationBag.Configuration.PointId) || (receiverChannelId == ConfigurationBag.Configuration.ChannelId && receiverPointId == ConfigurationBag.PointAll) || (receiverChannelId == ConfigurationBag.ChannelAll && receiverPointId == ConfigurationBag.PointAll); if (!requestAvailable) { // ****************************NOT FOR ME************************* return; } if (bubblingObject.SenderPointId == ConfigurationBag.Configuration.PointId) { // **************************** HA AREA ************************* if (bubblingObject.MessageType == "HA" && bubblingObject.HAGroup == ConfigurationBag.Configuration.HAGroup && EventsEngine.HAEnabled) { //If HA group member and HA EventsEngine.HAPoints[EventsEngine.HAPointTickId] = DateTime.Now; long haTickFrom = long.Parse(UTF8Encoding.UTF8.GetString(bubblingObject.Data)); //if same tick then return because same point if (haTickFrom == EventsEngine.HAPointTickId) { return; } DateTime dt; lock (EventsEngine.HAPoints) { //If not exist then add if (!EventsEngine.HAPoints.TryGetValue(haTickFrom, out dt)) { EventsEngine.HAPoints.Add(haTickFrom, DateTime.Now); } else { EventsEngine.HAPoints[haTickFrom] = DateTime.Now; } } byte[] content = UTF8Encoding.UTF8.GetBytes(EventsEngine.HAPointTickId.ToString()); BubblingObject bubblingObjectToSync = new BubblingObject(content); bubblingObject.MessageType = "HA"; OffRampEngineSending.SendMessageOffRamp(bubblingObjectToSync, "HA", bubblingObject.SenderChannelId, bubblingObject.SenderPointId, string.Empty); } else { return; } } // ****************************GET FROM STORAGE IF REQUIRED************************* if (bubblingObject.Persisting) { bubblingObject = (BubblingObject) SerializationEngine.ByteArrayToObject( DevicePersistentProvider.PersistEventFromStorage(bubblingObject.MessageId)); } #region EVENT // ****************************IF EVENT TYPE************************* if (bubblingObject.MessageType == "Event") { //If HA group member and HA if (EventsEngine.HAEnabled) { //Check if is the first in list, if not then discard EventsEngine.HAPoints.OrderBy(key => key.Key); if (EventsEngine.HAPoints.Count > 1 && EventsEngine.HAPoints.First().Key != EventsEngine.HAPointTickId) { return; } } //Check if is Syncronouse response if (bubblingObject.SyncronousFromEvent && bubblingObject.SenderPointId == ConfigurationBag.Configuration.PointId) { //Yes it's a syncronous response from my request from this pointid //Execute the delegate and exit var propDataContext = bubblingObject.DataContext; bubblingObject.SyncronousFromEvent = false; EventsEngine.SyncAsyncEventsExecuteDelegate(bubblingObject.SyncronousToken, propDataContext); bubblingObject.SenderPointId = ""; bubblingObject.SyncronousToken = ""; return; } // ****************************EVENT EXIST EXECUTE************************* EventsEngine.ExecuteEventsInTrigger( bubblingObject, bubblingObject.Events[0], false, bubblingObject.SenderPointId); return; } #endregion #region CONSOLE // **************************** SYNC AREA ************************* //******************* OPERATION CONF BAG- ALL THE CONF FILES AND DLLS **************************************************************** //Receive a package folder to syncronize him self if (bubblingObject.MessageType == "SyncPull") { byte[] content = Helpers.CreateFromDirectory( ConfigurationBag.Configuration.DirectoryOperativeRootExeName); BubblingObject bubblingObjectToSync = new BubblingObject(content); bubblingObject.MessageType = "SyncPush"; OffRampEngineSending.SendMessageOffRamp(bubblingObjectToSync, "SyncPush", bubblingObject.SenderChannelId, bubblingObject.SenderPointId, string.Empty); } //Receive the request to send the bubbling if (bubblingObject.MessageType == "SyncPush") { LogEngine.DirectEventViewerLog( $"Received a syncronization package from channel ID {bubblingObject.SenderChannelId} and point ID {bubblingObject.SenderChannelId}\rAutoSyncronizationEnabled parameter = {ConfigurationBag.Configuration.AutoSyncronizationEnabled}", 2); if (ConfigurationBag.Configuration.AutoSyncronizationEnabled) { byte[] bubblingContent = SerializationEngine.ObjectToByteArray(bubblingObject.Data); string currentSyncFolder = ConfigurationBag.SyncDirectorySyncIn(); Helpers.CreateFromBytearray(bubblingObject.Data, currentSyncFolder); } } #endregion } catch (Exception ex) { LogEngine.WriteLog(ConfigurationBag.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.LogLevelError, Constant.TaskCategoriesError, ex, Constant.LogLevelError); } }
/// <summary> /// Execute polling /// </summary> /// restart public static void StartEventEngine(SetEventActionEvent delegateActionEventEmbedded) { try { var current = AppDomain.CurrentDomain; current.AssemblyResolve += HandleAssemblyResolve; LogEngine.Enabled = Configuration.LoggingEngineEnabled(); LogEngine.ConsoleWriteLine("Load Engine configuration.", ConsoleColor.White); //****************************Check for updates //Check if need to update files received from partners LogEngine.ConsoleWriteLine("Check Engine Syncronization.", ConsoleColor.White); EventsEngine.CheckForFileToUpdate(); //****************************Check for updates //Set service states LogEngine.ConsoleWriteLine("Initialize Engine Service states.", ConsoleColor.White); ServiceStates.RunPolling = true; ServiceStates.RestartNeeded = false; LogEngine.ConsoleWriteLine("Initialize Engine.", ConsoleColor.Cyan); EventsEngine.InitializeEventEngine(delegateActionEventEmbedded); //Init Message ingestor MessageIngestor.Init(); //Create the two sends layers // in EventsEngine if (!Configuration.DisableExternalEventsStreamEngine()) { LogEngine.ConsoleWriteLine("Start Internal Event Engine Channel.", ConsoleColor.Yellow); var canStart = EventsEngine.CreateEventUpStream(); if (!canStart) { LogEngine.WriteLog( Configuration.EngineName, $"Error during engine service starting. Name: {Configuration.EngineName} - ID: {Configuration.ChannelId()}", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Error); Thread.Sleep(Configuration.WaitTimeBeforeRestarting()); Environment.Exit(0); } //in EventUpStream LogEngine.ConsoleWriteLine("Start External Event Engine Channel.", ConsoleColor.Yellow); //OnRamp start the OnRamp Engine canStart = OffRampEngineSending.Init("MSP Device Component.dll (vNext)"); if (!canStart) { LogEngine.WriteLog( Configuration.EngineName, $"Error during engine service starting. Name: {Configuration.ChannelName()} - ID: {Configuration.ChannelId()}", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Error); Thread.Sleep(Configuration.WaitTimeBeforeRestarting()); Environment.Exit(0); } } //*****************Event object stream area********************* //Load the global event and triggers dlls var numOfTriggers = 0; var numOfEvents = 0; var triggersAndEventsLoaded = EventsEngine.LoadBubblingEventList(ref numOfTriggers, ref numOfEvents); if (triggersAndEventsLoaded) { LogEngine.ConsoleWriteLine( $"Triggers loaded {numOfTriggers} - Events loaded {numOfEvents}", ConsoleColor.DarkCyan); } EventsEngine.UpdateAssemblyEventListShared(); //Load the Active triggers and the active events EventsEngine.RefreshBubblingSetting(); //Start triggers single instances EventsEngine.ExecuteBubblingTriggerConfigurationsSingleInstance(); //Start triggers polling instances if (Configuration.EnginePollingTime() > 0) { var treadPollingRun = new Thread(StartTriggerPolling); treadPollingRun.Start(); } else { LogEngine.WriteLog(Configuration.EngineName, $"Configuration.EnginePollingTime = {Configuration.EnginePollingTime()}, internal polling system disabled.", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Warning); } //Start Engine Service LogEngine.ConsoleWriteLine( "Asyncronous Threading Service state active.", ConsoleColor.DarkCyan); var treadEngineStates = new Thread(CheckServiceStates); treadEngineStates.Start(); if (!Configuration.DisableExternalEventsStreamEngine()) { LogEngine.ConsoleWriteLine("Start On Ramp Engine.", ConsoleColor.Green); var onRampEngineReceiving = new OnRampEngineReceiving(); onRampEngineReceiving.Init("component.dll name"); } // Configuration files watcher EventsEngine.StartConfigurationSyncEngine(); LogEngine.WriteLog( Configuration.EngineName, $"Engine service initialization procedure terminated. Name: {Configuration.ChannelName()} - ID: {Configuration.ChannelId()}", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Information); } catch (Exception ex) { LogEngine.WriteLog( Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.DefconOne, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); } }
/// <summary> /// Execute polling /// </summary> /// restart public static void StartEventEngine(ActionEvent delegateEmbedded) { try { LogEngine.DirectEventViewerLog("Engine starting...", 4); var current = AppDomain.CurrentDomain; current.AssemblyResolve += HandleAssemblyResolve; LogEngine.Enabled = ConfigurationBag.Configuration.LoggingEngineEnabled; Debug.WriteLine("Load Engine configuration."); //****************************Check for updates //Check if need to update files received from partners Debug.WriteLine( $"Check Engine Syncronization {ConfigurationBag.Configuration.AutoSyncronizationEnabled}.", ConsoleColor.White); if (ConfigurationBag.Configuration.AutoSyncronizationEnabled) { EventsEngine.SyncronizePoint(); } //Set service states Debug.WriteLine("Initialize Engine Service states."); ServiceStates.RunPolling = ConfigurationBag.Configuration.RunInternalPolling; ServiceStates.RestartNeeded = false; Debug.WriteLine("Initialize Engine."); EventsEngine.InitializeEventEngine(delegateEmbedded); //Init Message ingestor MessageIngestor.InitSecondaryPersistProvider(); //Create the two sends layers Debug.WriteLine("Start Internal Event Engine Channel."); //in EventUpStream Debug.WriteLine("Start External Event Engine Channel."); //OnRamp start the OnRamp Engine var canStart = OffRampEngineSending.Init("MSP Device Component.dll (vNext)"); if (!canStart) { LogEngine.WriteLog( ConfigurationBag.EngineName, $"Error during engine service starting. Name: {ConfigurationBag.Configuration.ChannelName} - ID: {ConfigurationBag.Configuration.ChannelId}", Constant.LogLevelError, Constant.TaskCategoriesError, null, Constant.LogLevelError); Thread.Sleep(ConfigurationBag.Configuration.WaitTimeBeforeRestarting); Environment.Exit(0); } if (EventsEngine.HAEnabled) { Thread haCheck = new Thread(EventsEngine.HAPointsUpdate); haCheck.Start(); Thread haClean = new Thread(EventsEngine.HAPointsClean); haClean.Start(); } //*****************Event object stream area********************* //Load the global event and triggers dlls var numOfTriggers = 0; var numOfEvents = 0; var numOfComponents = 0; var triggersAndEventsLoaded = EventsEngine.LoadAssemblyComponents(ref numOfTriggers, ref numOfEvents, ref numOfComponents); if (triggersAndEventsLoaded) { Debug.WriteLine( $"Triggers loaded {numOfTriggers} - Events loaded {numOfEvents}", ConsoleColor.DarkCyan); } //Load the Active triggers and the active events EventsEngine.RefreshBubblingSetting(false); //Start triggers single instances EventsEngine.ExecuteBubblingTriggerConfigurationsSingleInstance(); //Start triggers polling instances if (ConfigurationBag.Configuration.EnginePollingTime > 0) { var treadPollingRun = new Thread(StartTriggerPolling); treadPollingRun.Start(); } else { LogEngine.WriteLog(ConfigurationBag.EngineName, $"Configuration.EnginePollingTime = {ConfigurationBag.Configuration.EnginePollingTime}, internal polling system disabled.", Constant.LogLevelError, Constant.TaskCategoriesError, null, Constant.LogLevelWarning); } //Start Engine Service Debug.WriteLine( "Asyncronous Threading Service state active.", ConsoleColor.DarkCyan); var treadEngineStates = new Thread(CheckServiceStates); treadEngineStates.Start(); Debug.WriteLine("Start On Ramp Engine.", ConsoleColor.Green); var onRampEngineReceiving = new OnRampEngineReceiving(); onRampEngineReceiving.Init("component.dll name"); // Configuration files watcher //****************************Start folder whatcher EventsEngine.StartFolderWatcherEngine(); //****************************Start folder whatcher LogEngine.WriteLog( ConfigurationBag.EngineName, $"Engine service initialization procedure terminated. Name: {ConfigurationBag.Configuration.ChannelName} - ID: {ConfigurationBag.Configuration.ChannelId}", Constant.LogLevelError, Constant.TaskCategoriesError, null, Constant.LogLevelInformation); LogEngine.DirectEventViewerLog("Engine started.", 4); } catch (Exception ex) { LogEngine.WriteLog( ConfigurationBag.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.LogLevelError, Constant.TaskCategoriesError, ex, Constant.LogLevelError); } }
public static void IngestMessagge(object message) { string senderId; string senderDescription; byte[] eventDataByte = null; var skeletonMessage = (ISkeletonMessage)message; // ****************************IF MESSAGE TYPE = GRABCASTER************************* try { // Check message subscription, it must come from engine if (skeletonMessage.Properties[Configuration.GrabCasterMessageTypeName].ToString() != Configuration.GrabCasterMessageTypeValue) { LogEngine.ConsoleWriteLine( "Not GrabCaster message type received -DISCARED-", ConsoleColor.DarkYellow); return; } else { // Who sent the message senderId = skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(); senderDescription = skeletonMessage.Properties[Configuration.MessageDataProperty.SenderDescriprion.ToString()].ToString(); //If using Guid pattern as string some system put an escape character like \ before the end brachet } // Who receive the message LogEngine.ConsoleWriteLine( $"Event received from Sender {senderId} Sender description {senderDescription}", ConsoleColor.DarkCyan); // ****************************IF SAME SENDER************************* //TODO DELETE the + "debug" if (senderId == Configuration.PointId() + "debug") { LogEngine.ConsoleWriteLine("Same sender ID event discared.", ConsoleColor.Green); return; } } } catch (Exception ex) { // If error then not message typeof (no property present.) LogEngine.WriteLog( Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name} - Not GrabCaster message type received (Missing GrabCaster_MessageType_Name properties.) -DISCARED-", Constant.DefconOne, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); return; } try { // ****************************GET FROM STORAGE IF REQUIRED************************* if ((bool)skeletonMessage.Properties[Configuration.MessageDataProperty.Persisting.ToString()]) { ParametersPersistEventFromBlob[0] = skeletonMessage.Properties[Configuration.MessageDataProperty.MessageId.ToString()]; var ret = methodPersistEventFromBlob.Invoke(classInstanceDpp, ParametersPersistEventFromBlob); eventDataByte = (byte[])ret; } else { eventDataByte = skeletonMessage.Body; } //******************************************************************* // 3 IF TYPES EVENT - CONSOLE - REST // first area events, second console, third rest //******************************************************************* // ****************************IF EVENT TYPE************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.Event.ToString()) { // ****************************IF EMBEDED TYPE EXECUTE TRIGGER************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.Embedded.ToString()].ToString() == "true") { var recChannelId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverChannelId.ToString()].ToString(); var recPointId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverPointId.ToString()].ToString(); //If using Guid pattern as string some system put an escape character like \ before the end brachet } var reqAvailable = (recChannelId.Contains(Configuration.ChannelId()) && recPointId.Contains(Configuration.PointId())) || (recChannelId.Contains(Configuration.ChannelAll) && recPointId.Contains(Configuration.PointId())) || (recChannelId.Contains(Configuration.ChannelId()) && recPointId.Contains(Configuration.ChannelAll)) || (recChannelId.Contains(Configuration.ChannelAll) && recPointId.Contains(Configuration.ChannelAll)); if (!reqAvailable) { return; } string idConfiguration = skeletonMessage.Properties[Configuration.MessageDataProperty.IdConfiguration.ToString()].ToString(); string idComponent = skeletonMessage.Properties[Configuration.MessageDataProperty.IdComponent.ToString()].ToString(); try { var triggerSingleInstance = (from trigger in EventsEngine.BubblingTriggerConfigurationsSingleInstance where trigger.IdComponent == idComponent && trigger.IdConfiguration == idConfiguration select trigger).First(); var bubblingTriggerConfiguration = triggerSingleInstance; LogEngine.ConsoleWriteLine($"Execute trigger idConfiguration {idConfiguration} and idComponent {idComponent}", ConsoleColor.Green); EventsEngine.ExecuteTriggerConfiguration(bubblingTriggerConfiguration, skeletonMessage.Body); } catch (Exception ex) { LogEngine.WriteLog(Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name} - ExecuteTriggerConfiguration Error - Missing the idConfiguration {idConfiguration} and idComponent {idComponent}", Constant.DefconOne, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); } // ****************************IF EMBEDED RETURN HERE************************* return; } // ****************************CAST TO BUBBLING EVENT************************* var eventBubbling = (BubblingEvent)SerializationEngine.ByteArrayToObject(eventDataByte); // ****************************PERSIST MESSAGE IN FOLDER************************* PersistentProvider.PersistMessage(eventBubbling, PersistentProvider.CommunicationDiretion.OffRamp); if (Configuration.LoggingVerbose()) { var serializedEvents = JsonConvert.SerializeObject( eventBubbling.Events, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); LogEngine.ConsoleWriteLine( $"Event received from point id: {skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()]} -point name : {skeletonMessage.Properties[Configuration.MessageDataProperty.SenderDescriprion.ToString()]} - {serializedEvents}", ConsoleColor.Green); } // ****************************IF EXIST EVENT TO EXECUTE************************* var eventsAvailable = from eventbubble in eventBubbling.Events from channel in eventbubble.Channels from point in channel.Points where (channel.ChannelId == Configuration.ChannelId() && point.PointId == Configuration.PointId()) || (channel.ChannelId == Configuration.ChannelAll && point.PointId == Configuration.PointId()) || (channel.ChannelId == Configuration.ChannelId() && point.PointId == Configuration.PointAll) || (channel.ChannelId == Configuration.ChannelAll && point.PointId == Configuration.PointAll) select eventbubble; if (!eventsAvailable.Any()) { // ****************************NO EVENT RETURN************************* return; } // ****************************EVENT EXIST EXECUTE************************* EventsEngine.ExecuteBubblingActionEvent( eventBubbling, false, skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString()); return; } var receiverChannelId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverChannelId.ToString()].ToString(); var receiverPointId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverPointId.ToString()].ToString(); var requestAvailable = (receiverChannelId == Configuration.ChannelId() && receiverPointId == Configuration.PointId()) || (receiverChannelId == Configuration.ChannelAll && receiverPointId == Configuration.PointId()) || (receiverChannelId == Configuration.ChannelId() && receiverPointId == Configuration.PointAll) || (receiverChannelId == Configuration.ChannelAll && receiverPointId == Configuration.PointAll); if (!requestAvailable) { // ****************************NOT FOR ME************************* return; } // **************************** SYNC AREA ************************* //Save in a string to simplify the reading and code string OperationTypRequested = skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString(); //******************* OPERATION CONF BAG- ALL THE CONF FILES AND DLLS **************************************************************** //Receive the request to send the bubbling if (OperationTypRequested == Configuration.MessageDataProperty.ConsoleRequestSendBubblingBag.ToString()) { if (!Configuration.DisableExternalEventsStreamEngine()) { //If I am console do nothing if (Configuration.IamConsole()) { OffRampEngineSending.SendMessageOnRamp( EventsEngine.bubblingBag, Configuration.MessageDataProperty.ConsoleBubblingBagToSyncronize, skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), null, null); } } else { LogEngine.WriteLog( Configuration.EngineName, "Warning the Device Provider Interface is disable, the GrabCaster point will be able to work in local mode only.", Constant.DefconThree, Constant.TaskCategoriesError, null, EventLogEntryType.Warning); } } //Receive the request to send the bubbling if (OperationTypRequested == Configuration.MessageDataProperty.ConsoleBubblingBagToSyncronize.ToString()) { if (!Configuration.DisableExternalEventsStreamEngine()) { //se non sono console //metto if (!Configuration.IamConsole()) { byte[] bubblingContent = SerializationEngine.ObjectToByteArray(skeletonMessage.Body); string currentSyncFolder = Configuration.SyncDirectorySyncIn(); GrabCaster.Framework.CompressionLibrary.Helpers.CreateFromBytearray(skeletonMessage.Body, currentSyncFolder); } else { setConsoleActionEventEmbedded(skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), skeletonMessage); } } else { LogEngine.WriteLog( Configuration.EngineName, "Warning the Device Provider Interface is disable, the GrabCaster point will be able to work in local mode only.", Constant.DefconThree, Constant.TaskCategoriesError, null, EventLogEntryType.Warning); } } } catch (Exception ex) { LogEngine.WriteLog(Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.DefconOne, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); } }
public static void IngestMessagge(object message) { string senderId; string senderDescription; byte[] eventDataByte = null; var skeletonMessage = (ISkeletonMessage)message; // ****************************IF MESSAGE TYPE = GRABCASTER************************* try { // Check message subscription, it must come from engine if (skeletonMessage.Properties[Configuration.GrabCasterMessageTypeName].ToString() != Configuration.GrabCasterMessageTypeValue) { LogEngine.ConsoleWriteLine( "Not GrabCaster message type received -DISCARED-", ConsoleColor.DarkYellow); return; } else { // Who sent the message senderId = skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(); senderDescription = skeletonMessage.Properties[Configuration.MessageDataProperty.SenderDescriprion.ToString()].ToString(); //If using Guid pattern as string some system put an escape character like \ before the end brachet } // Who receive the message LogEngine.ConsoleWriteLine( $"Event received from Sender {senderId} Sender description {senderDescription}", ConsoleColor.DarkCyan); // ****************************IF SAME SENDER************************* if (senderId == Configuration.PointId()) { LogEngine.ConsoleWriteLine("Same sender ID event discared.", ConsoleColor.Green); return; } } } catch (Exception ex) { // If error then not message typeof (no property present.) LogEngine.WriteLog( Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name} - Not GrabCaster message type received (Missing GrabCaster_MessageType_Name properties.) -DISCARED-", Constant.ErrorEventIdHighCritical, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); return; } try { // ****************************GET FROM STORAGE IF REQUIRED************************* if ((bool)skeletonMessage.Properties[Configuration.MessageDataProperty.Persisting.ToString()]) { ParametersPersistEventFromBlob[0] = skeletonMessage.Properties[Configuration.MessageDataProperty.MessageId.ToString()]; var ret = methodPersistEventFromBlob.Invoke(classInstanceDpp, ParametersPersistEventFromBlob); eventDataByte = (byte[])ret; } else { eventDataByte = skeletonMessage.Body; } //******************************************************************* // 3 IF TYPES EVENT - CONSOLE - REST // first area events, second console, third rest //******************************************************************* // ****************************IF EVENT TYPE************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.Event.ToString()) { // ****************************IF EMBEDED TYPE EXECUTE TRIGGER************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.Embedded.ToString()].ToString() == "true") { var recChannelId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverChannelId.ToString()].ToString(); var recPointId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverPointId.ToString()].ToString(); //If using Guid pattern as string some system put an escape character like \ before the end brachet } var reqAvailable = (recChannelId.Contains(Configuration.ChannelId()) && recPointId.Contains(Configuration.PointId())) || (recChannelId.Contains(Configuration.ChannelAll) && recPointId.Contains(Configuration.PointId())) || (recChannelId.Contains(Configuration.ChannelId()) && recPointId.Contains(Configuration.ChannelAll)) || (recChannelId.Contains(Configuration.ChannelAll) && recPointId.Contains(Configuration.ChannelAll)); if (!reqAvailable) { return; } string idConfiguration = skeletonMessage.Properties[Configuration.MessageDataProperty.IdConfiguration.ToString()].ToString(); string idComponent = skeletonMessage.Properties[Configuration.MessageDataProperty.IdComponent.ToString()].ToString(); try { var triggerSingleInstance = (from trigger in EventsEngine.BubblingTriggerConfigurationsSingleInstance where trigger.IdComponent == idComponent && trigger.IdConfiguration == idConfiguration select trigger).First(); var bubblingTriggerConfiguration = triggerSingleInstance; LogEngine.ConsoleWriteLine($"Execute trigger idConfiguration {idConfiguration} and idComponent {idComponent}", ConsoleColor.Green); EventsEngine.ExecuteTriggerConfiguration(bubblingTriggerConfiguration, skeletonMessage.Body); } catch (Exception ex) { LogEngine.WriteLog(Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name} - ExecuteTriggerConfiguration Error - Missing the idConfiguration {idConfiguration} and idComponent {idComponent}", Constant.ErrorEventIdHighCritical, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); } // ****************************IF EMBEDED RETURN HERE************************* return; } // ****************************CAST TO BUBBLING EVENT************************* var eventBubbling = (BubblingEvent)SerializationEngine.ByteArrayToObject(eventDataByte); // ****************************PERSIST MESSAGE IN FOLDER************************* PersistentProvider.PersistMessage(eventBubbling, PersistentProvider.CommunicationDiretion.OffRamp); if (Configuration.LoggingVerbose()) { var serializedEvents = JsonConvert.SerializeObject( eventBubbling.Events, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); LogEngine.ConsoleWriteLine( $"Event received from point id: {skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()]} -point name : {skeletonMessage.Properties[Configuration.MessageDataProperty.SenderDescriprion.ToString()]} - {serializedEvents}", ConsoleColor.Green); } // ****************************IF EXIST EVENT TO EXECUTE************************* var eventsAvailable = from eventbubble in eventBubbling.Events from channel in eventbubble.Channels from point in channel.Points where (channel.ChannelId == Configuration.ChannelId() && point.PointId == Configuration.PointId()) || (channel.ChannelId == Configuration.ChannelAll && point.PointId == Configuration.PointId()) || (channel.ChannelId == Configuration.ChannelId() && point.PointId == Configuration.PointAll) || (channel.ChannelId == Configuration.ChannelAll && point.PointId == Configuration.PointAll) select eventbubble; if (!eventsAvailable.Any()) { // ****************************NO EVENT RETURN************************* return; } // ****************************EVENT EXIST EXECUTE************************* EventsEngine.ExecuteBubblingActionEvent( eventBubbling, false, skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString()); return; } var receiverChannelId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverChannelId.ToString()].ToString(); var receiverPointId = skeletonMessage.Properties[Configuration.MessageDataProperty.ReceiverPointId.ToString()].ToString(); var requestAvailable = (receiverChannelId == Configuration.ChannelId() && receiverPointId == Configuration.PointId()) || (receiverChannelId == Configuration.ChannelAll && receiverPointId == Configuration.PointId()) || (receiverChannelId == Configuration.ChannelId() && receiverPointId == Configuration.PointAll) || (receiverChannelId == Configuration.ChannelAll && receiverPointId == Configuration.PointAll); if (!requestAvailable) { // ****************************NOT FOR ME************************* return; } // **************************** IF CONSOLE TYPE ************************* //Save in a string to simplify the reading and code string OperationTypRequested = skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString(); //******************* OPERATION CONF BAG- ALL THE CONF FILES AND DLLS **************************************************************** if (OperationTypRequested == Configuration.MessageDataProperty.ConsoleSendBubblingBag.ToString() || OperationTypRequested == Configuration.MessageDataProperty.ConsoleSendBubblingBagFromPoint.ToString()) { //If send or received operaion bool sendOperation = true && OperationTypRequested == Configuration.MessageDataProperty.ConsoleSendBubblingBag.ToString(); if (!Configuration.DisableDeviceProviderInterface()) { if (sendOperation) { OffRampEngineSending.SendMessageOnRamp( EventsEngine.bubblingBag, Configuration.MessageDataProperty.ConsoleSendBubblingBagFromPoint, skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), null, null); } else { setConsoleActionEventEmbedded( Configuration.MessageDataProperty.ReceiverPointId.ToString(), skeletonMessage); } } else { LogEngine.WriteLog( Configuration.EngineName, "Warning the Device Provider Interface is disable, the GrabCaster point will be able to work in local mode only.", Constant.ErrorEventIdHighCritical, Constant.TaskCategoriesError, null, EventLogEntryType.Warning); } } //******************* OPERATION CONF BAG- ALL THE CONF FILES AND DLLS **************************************************************** // **************************** REST SERVICE CALLS AREA ************************* //RICEVE I BUBBLINGS // ****************************WRITE THE TRIGGERS AND EVENTS CONFIGURATION FILES IN FOLDERS************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendBubblingConfiguration.ToString()) { // eventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendBubblingConfiguration from - {senderId} - {senderDescription}", ConsoleColor.Cyan); var syncConfigurationFilelIst = (List <SyncConfigurationFile>)SerializationEngine.ByteArrayToObject(eventDataByte); SyncProvider.SyncBubblingConfigurationFileList( syncConfigurationFilelIst, skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderName.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderDescriprion.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelName.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelDescription.ToString()].ToString()); return; } //RICEVE LA CONF DAL PUNTO // ****************************WRITE THE POINT CONFIGURATION FILE IN FOLDERs************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendConfiguration.ToString()) { // EventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendConfiguration from - {senderId} - {senderDescription}", ConsoleColor.Cyan); SyncProvider.SyncWriteConfiguration( skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), eventDataByte); return; } //RICEVE E SCRIVE UN FILE DI CONFIGURAZIONE TRIGGER O EVENT NELLA BUBBLIG // ****************************WRITE THE SPECIFIC BUBBLING FILE IN FOLDERS************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendFileBubblingConfiguration.ToString()) { // EventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendFileBubblingConfiguration from - {senderId} - {senderDescription}", ConsoleColor.Cyan); var syncConfigurationFilelIst = (List <SyncConfigurationFile>)SerializationEngine.ByteArrayToObject(eventDataByte); SyncProvider.SyncLocalBubblingConfigurationFile(syncConfigurationFilelIst); return; } //SCRIVE UN COMP DLL IN EVENTO O TRIGGER FOLDER // ****************************UPDATE A DLL COMPONENT IN FILE IN FOLDERS************************* if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendComponent.ToString()) { // EventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendComponent from - {senderId} - {senderDescription}", ConsoleColor.Cyan); var eventBubbling = (BubblingEvent)SerializationEngine.ByteArrayToObject(eventDataByte); SyncProvider.SyncUpdateComponent( skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), eventBubbling); return; } // Request to send the local configuration // Send the configuration if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendRequestBubblingConfiguration.ToString()) { // EventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendBubblingConfiguration from - {senderId} - {senderDescription}", ConsoleColor.Cyan); SyncProvider.SyncSendBubblingConfiguration( skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString()); return; } // Request to send the configuration // Send the configuration if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendRequestConfiguration.ToString()) { // EventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendRequestConfiguration from - {senderId} - {senderDescription}", ConsoleColor.Cyan); SyncProvider.SyncSendConfiguration(skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString()); return; } // Request to send back a component if (skeletonMessage.Properties[Configuration.MessageDataProperty.MessageType.ToString()].ToString() == Configuration.MessageDataProperty.SyncSendRequestComponent.ToString()) { // EventDataByte = NULL LogEngine.ConsoleWriteLine( $"SyncSendRequestComponent from - {senderId} - {senderDescription}", ConsoleColor.Cyan); SyncProvider.SyncSendComponent( skeletonMessage.Properties[Configuration.MessageDataProperty.ChannelId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.SenderId.ToString()].ToString(), skeletonMessage.Properties[Configuration.MessageDataProperty.IdComponent.ToString()].ToString()); return; } } catch (Exception ex) { LogEngine.WriteLog(Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.ErrorEventIdHighCritical, Constant.TaskCategoriesError, ex, EventLogEntryType.Error); } }