/// <summary> /// A verification response has been returned. /// </summary> /// <param id="state">The state object of the response.</param> private void verificationResponse(ClientState state) { SerializationEngine serializer = new SerializationEngine(); Verification vResponse = (Verification)serializer.Deserialize(state.GetDataArray()); NodeID = vResponse.NodeID; HostName = vResponse.HostName; DPI = vResponse.DPI; CPUCount = vResponse.CPUCount; RunningJobs = vResponse.JobCount; TotalMemory = vResponse.TotalMemory; //make sure the assembly and domain listing is good foreach (string assembly in loadedAssemblies) { if (!loadedAssemblies.Contains(assembly)) { loadedAssemblies.Add(assembly); } } foreach (string domain in loadedDomains) { if (!loadedDomains.Contains(domain)) { loadedDomains.Add(domain); } } }
/// <summary> /// A distributed job has completed succesfully and this is the response. /// </summary> /// <param id="state">The state object of the response.</param> private void returnExecution(ClientState state) { SerializationEngine serializer = new SerializationEngine(); ExecutionResult res = (ExecutionResult)serializer.Deserialize(state.GetDataArray()); DomainManager.ReturnExecution(res); }
private static void Generate(string tempFile, SerializationEngine serializer, List <TestClass> list, Action <Action <int> > loop) { using (var stream = new FileStream(tempFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) { var data = new StreamAccessor(stream); var lFile = new LowLevelAppendOnlyFile(data); var file = new GenericAppendOnlyFile <TestClass>(lFile, serializer); // append COUNT records ShowTime("append", () => loop(i => file.Append(list[i]))); // read all the records ShowTime("read all", () => { var records = file.ReadFrom(0).ToList(); }); // read all the records, one at a time ShowTime("read all, one at a time", () => loop(i => file.Read(i))); } // close and reopen the file (rebuilds the index) ShowTime("rebuild index", () => { using (var stream = new FileStream(tempFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { var data = new StreamAccessor(stream); var lFile = new LowLevelAppendOnlyFile(data); } }); }
/// <summary> /// Write the status of the cluster to the console. /// </summary> public static void status() { TcpClient client = new TcpClient(); client.Connect("127.0.0.1", Int32.Parse(Config.GetParameter("SERVER_PORT"))); NetworkStream stream = client.GetStream(); byte[] messageTypeEncoded = ASCIIEncoding.ASCII.GetBytes(MessageType.STATUS_TERMINAL); List <byte> message = new List <byte>(BitConverter.GetBytes((long)(8))); message.AddRange(messageTypeEncoded); stream.Write(message.ToArray(), 0, message.ToArray().Length); byte[] messageSize = new byte[8]; stream.Read(messageSize, 0, 8); long size = BitConverter.ToInt64(messageSize, 0); int sizeInt = (int)size; byte[] dataArray = new byte[sizeInt]; stream.Read(dataArray, 0, sizeInt); List <byte> datas = new List <byte>(dataArray); datas.RemoveRange(0, 8); SerializationEngine serializer = new SerializationEngine(); ServerStatus status = (ServerStatus)serializer.Deserialize(datas.ToArray()); //Console Writes Console.WriteLine("Node Count: " + status.NodeCount); Console.WriteLine("Cluster DPI: " + status.CDPI); Console.WriteLine("Total CPU Count: " + status.CPUCount); Console.WriteLine("Total Memory: " + status.TotalMemory); }
private static void Generate(string tempFile, SerializationEngine serializer, List<TestClass> list, Action<Action<int>> loop) { using (var stream = new FileStream(tempFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) { var data = new StreamAccessor(stream); var lFile = new LowLevelAppendOnlyFile(data); var file = new GenericAppendOnlyFile<TestClass>(lFile, serializer); // append COUNT records ShowTime("append", () => loop(i => file.Append(list[i]))); // read all the records ShowTime("read all", () => { var records = file.ReadFrom(0).ToList(); }); // read all the records, one at a time ShowTime("read all, one at a time", () => loop(i => file.Read(i))); } // close and reopen the file (rebuilds the index) ShowTime("rebuild index", () => { using (var stream = new FileStream(tempFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { var data = new StreamAccessor(stream); var lFile = new LowLevelAppendOnlyFile(data); } }); }
private static void Verify1(string tempFile, SerializationEngine serializer, IReadOnlyList <TestClass> list) { using (var stream = new FileStream(tempFile, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { var data = new StreamAccessor(stream); var lFile = new LowLevelAppendOnlyFile(data); var file = new GenericAppendOnlyFile <TestClass>(lFile, serializer); var records = file.ReadFrom(0).ToList(); // fails without sorting the lists, so the ordering is somehow incorrect //list = list.OrderBy(it => it.Name).ToList(); //records = records.OrderBy(it => it.Name).ToList(); // verify that the index is built correctly for (var i = 0; i < COUNT; i++) { var r = records[i]; if (r.Name != list[i].Name) { throw new Exception($"Verify1: Expected [{list[i].Name}] but was [{r.Name}]."); } if (r.Address != list[i].Address) { throw new Exception($"Verify1: Expected [{list[i].Address}] but was [{r.Address}]."); } } } }
/// <summary> /// This server needs to verify itself and send back a Verfication object. /// </summary> /// <param id="state">The server state object.</param> private static void verifyResponse(ServerState state) { Transfers.Verification verification = new Transfers.Verification(NodeID, ClusterManager.HostName, DPI.GetDPI(), Memory.GetTotalSize(), CPU.GetCount(), Executor.RunningJobs(), DomainManager.GetAllDomainKeys(), DomainManager.GetAllAssemblyNames()); SerializationEngine serializer = new SerializationEngine(); state.Write(MessageType.VERIFICATION_RESPONSE, serializer.Serialize(verification).ToArray()); }
/// <summary> /// The clone object. /// </summary> /// <param name="clonedObject"> /// The cloned object. /// </param> /// <returns> /// The <see cref="object" />. /// </returns> public static object CloneObject(object clonedObject) { var objserialized = SerializationEngine.ObjectToByteArray(clonedObject); var newobject = SerializationEngine.ByteArrayToObject(objserialized); return(newobject); }
/// <summary> /// Recieve a user message from a remote node. /// </summary> /// <param name="state">The server state object of this transfer.</param> private static void receiveMessage(ServerState state) { SerializationEngine serializer = new SerializationEngine(); UserMessage message = (UserMessage)serializer.Deserialize(state.GetDataArray()); DomainManager.DeliverMessage(message); }
//------------Methods-----------------------// /// <summary> /// Deploys an execution job into the cluster. /// /// The method passed in as "function" MUST be static. If it is not, an error will be thrown and added to the error log. /// Instance data is not preserved outside of the running ApplicationDomain and indeed all data not instantiated within the /// method or not globally synchronized using a cluster data structure is considered volatile, mutable, inconsitent and untrustworthy. /// /// DO NOT write code that will depend on instance or static class variables in order to do processing /// unless those variables are declared constant from the start of the module. Write functions as if they are black boxes, /// the only thing you see is input and output. /// </summary> /// <param name="function">The function to be executed.</param> /// <param name="parameter">The parameter to be passed into the executed function.</param> /// <param name="callback">The callback to be executed when the function completes.</param> /// <returns>The execution ID of this particular execution.</returns> public static string Execute(Func <PrestoParameter, PrestoResult> function, PrestoParameter parameter, Action <PrestoResult> callback) { //set the event to non signaled jobCompletionEvent.Reset(); if (!function.Method.IsStatic) { //I should really make some presto specific exceptions... i will add that to the todo. throw new Exception("Function is not static"); } //Get a DateTime to mark the beginning of an execution DateTime now = DateTime.Now; string contextID = Generator.RandomAlphaNumeric(Config.UIDLength); //Create a reset event and add it to the dictionary for this job ManualResetEvent mre = new ManualResetEvent(false); waits[contextID] = mre; //add the job to the scheduled jobs outboundJobs[contextID] = callback; //execute SerializationEngine serializer = new SerializationEngine(); byte[] stream = serializer.Serialize(parameter); ClusterProxy.Execute(function.Method.DeclaringType.Assembly.FullName, function.Method.DeclaringType.FullName, function.Method.Name, stream, contextID, Key); return(contextID); }
private static void Verify2(string tempFile, SerializationEngine serializer, IReadOnlyList <TestClass> list) { using (var data = new FileAccessor(tempFile)) { var lFile = new LowLevelAppendOnlyFile(data); var file = new GenericAppendOnlyFile <TestClass>(lFile, serializer); var records = file.ReadFrom(0).ToList(); // fails even when sorting the lists //list = list.OrderBy(it => it.Name).ToList(); //records = records.OrderBy(it => it.Name).ToList(); // verify that the index is built correctly for (var i = 0; i < COUNT; i++) { var r = records[i]; if (r.Name != list[i].Name) { throw new Exception($"Verify2: Expected [{list[i].Name}] but was [{r.Name}]."); } if (r.Address != list[i].Address) { throw new Exception($"Verify2: Expected [{list[i].Address}] but was [{r.Address}]."); } } } }
/// <summary> /// Return an execution back into the domain. /// </summary> /// <param name="contextID">The context ID of the execution.</param> /// <param name="nodeID">The node ID where the execution was run.</param> /// <param name="result">The serialized result of the excution.</param> public void ReturnExecution(string contextID, ClusterNode node, byte[] result) { SerializationEngine serializer = new SerializationEngine(); PrestoResult resultObj = (PrestoResult)serializer.Deserialize(result); resultObj.ExecutionNode = node; Cluster.ReturnExecution(contextID, resultObj); }
public void Serialize(SerializationEngine engine, IPropertySymbol property, ITypeSymbol type, CodeWriter code, string name, string typeIdentifier, Location location) { var named = (INamedTypeSymbol)type; var types = named.TypeArguments; engine.AppendWriteLogic(property, types[0], code, $"{name}.Key", location); engine.AppendWriteLogic(property, types[1], code, $"{name}.Value", location); }
private static SerializationEngine CreateSerializationEngine() { var serializationRegistry = new SerializationRegistry(Encoding.ASCII); serializationRegistry.Register <PlaceOrderMessage, PlaceOrderMessageSerializer>(); serializationRegistry.Register <OrderAckMessage, OrderAckMessageSerializer>(_orderAckMessagePool, _orderAckMessagePool); var serializationEngine = new SerializationEngine(serializationRegistry); return(serializationEngine); }
public RioClient(IClientConfiguration configuration, SerializationEngine serializationEngine) { WinSock.EnsureIsInitialized(); _configuration = configuration; _serializationEngine = serializationEngine; _completionWorker = CreateWorker(); _messageDispatcher = new MessageDispatcher(); _session = CreateSession(); }
/// <summary> /// Execute an incoming job. /// </summary> /// <param name="methodName">The name of the procedure to be executed.</param> /// <param name="typeName">The name of the type held within the assembly for with the procedure to be executed resides.</param> /// <param name="assemblyName">The name of the assembly the procedure resides in.</param> /// <param name="parameter">The parameter passed to the executed procedure.</param> /// <returns>The result of the execution serialized for transport.</returns> public byte[] ExecuteIncoming(string methodName, string typeName, string assemblyName, byte[] parameter) { SerializationEngine serializer = new SerializationEngine(); PrestoParameter param = (PrestoParameter)serializer.Deserialize(parameter); Assembly assembly = assemblies[assemblyName]; Type type = assembly.GetType(typeName, false, true); MethodInfo method = type.GetMethod(methodName); PrestoResult res = (PrestoResult)method.Invoke(null, new object[] { param }); return(serializer.Serialize(res)); }
public RioServer(IServerConfiguration configuration, SerializationEngine serializationEngine) { WinSock.EnsureIsInitialized(); _configuration = configuration; _listeningSocket = CreateListeningSocket(); _workers = CreateWorkers(); _messageDispatcher = new MessageDispatcher(); _sessionManager = new SessionManager(configuration); _sessionManager.CreateSessions(_workers, serializationEngine); }
/// <summary> /// The dispatch action called when a status request is signaled. /// </summary> /// <param name="state">The server state object of the network connection.</param> public static void status(ServerState state) { ServerStatus status = new ServerStatus(); status.NodeCount = Nodes.GetTotalAvailableNodeCount(); status.CPUCount = Nodes.GetCPUCount(); status.CDPI = Nodes.GetCDPI(); status.TotalMemory = Nodes.GetTotalMemory(); SerializationEngine serializer = new SerializationEngine(); state.WriteAndClose(MessageType.STATUS_TERMINAL, serializer.Serialize(status)); }
/// <summary> /// Internal execute function to be called asynchronously. /// </summary> /// <param id="state">The server state object associated with the execution.</param> private static void execute(ServerState state) { Interlocked.Increment(ref runningJobs); //get the execution context SerializationEngine serializer = new SerializationEngine(); Transfers.ExecutionContext context = (Transfers.ExecutionContext)serializer.Deserialize(state.GetDataArray()); byte[] res = DomainManager.ExecuteIncoming(context); Transfers.ExecutionResult result = new Transfers.ExecutionResult(res, context.ContextID, context.DomainKey, ClusterManager.NodeID); state.Write(MessageType.EXECUTION_COMPLETE, serializer.Serialize(result)); Interlocked.Decrement(ref runningJobs); }
public void Serialize(SerializationEngine engine, IPropertySymbol property, ITypeSymbol type, CodeWriter code, string name, string typeIdentifier, Location location) { var named = (INamedTypeSymbol)type; var types = named.TypeArguments; for (var idx = 0; idx < Items; idx++) { var item = idx + 1; engine.AppendWriteLogic(property, types[idx], code, $"{name}.Item{item}", location); } }
public void Deserialize(SerializationEngine engine, IPropertySymbol property, ITypeSymbol type, CodeWriter code, string name, string typeIdentifier, Location location) { var named = (INamedTypeSymbol)type; var types = named.TypeArguments; code.AppendLine($"{SerializationEngine.GetQualifiedName(types[0])} key;"); code.AppendLine($"{SerializationEngine.GetQualifiedName(types[1])} value;"); engine.AppendReadLogic(property, types[0], code, "key", location); engine.AppendReadLogic(property, types[1], code, "value", location); code.AppendLine($"{name} = new {typeIdentifier}(key, value);"); }
public void CreateSessions(IList <RioCompletionWorker> workers, SerializationEngine serializationEngine) { if (_configuration.SessionCount <= 0) { throw new ArgumentOutOfRangeException(nameof(_configuration.SessionCount)); } _sessions.Clear(); _sessionCount = _configuration.SessionCount; for (var i = 0; i < _sessionCount; i++) { var worker = workers[i % workers.Count]; AddNewSession(i, worker, serializationEngine); } }
/// <summary> /// Send a message to the node with the specified ID. /// </summary> /// <param name="message">The user message struct to be sent.</param> public void SendMessage(UserMessage message) { if (!HasDomain(message.DomainKey)) { //get the assemblies Dictionary <string, byte[]> assemblies = DomainManager.GetDomainAssemblies(message.DomainKey); foreach (KeyValuePair <string, byte[]> assem in assemblies) { deliverAssembly(assem.Key, assem.Value, message.DomainKey); } } assemblyLoadReset.WaitOne(); SerializationEngine serializer = new SerializationEngine(); client.Write(MessageType.USER_MESSAGE, serializer.Serialize(message)); }
private static void CreateAndProcessFile(RandomAccessor data, SerializationEngine serializer, IReadOnlyList <TestClass> list, Action <Action <int> > loop) { var lFile = new LowLevelAppendOnlyFile(data); var file = new GenericAppendOnlyFile <TestClass>(lFile, serializer); // append COUNT records ShowTimeIncludingOpsPerSec("append", () => loop(i => file.Append(list[i]))); // read all the records in a single batch ShowTimeIncludingOpsPerSec("read all in a single batch", () => { var records = file.ReadFrom(0).ToList(); }); // read all the records, individually ShowTimeIncludingOpsPerSec("read all, individually", () => loop(i => file.Read(i))); }
/// <summary> /// Trigger an execution on this node. /// </summary> /// <param id="executionContext">The execution context of the job.</param> public bool Execute(ExecutionContext executionContext) { RunningJobs++; //first be sure that this node has the appropriate assembly loaded if (!HasAssembly(executionContext.AssemblyName)) { //get the assembly byte[] assembly = DomainManager.GetAssemblyStream(executionContext.AssemblyName); deliverAssembly(executionContext.AssemblyName, assembly, executionContext.DomainKey); } assemblyLoadReset.WaitOne(); //since we know that the other machine has the assembly loaded we can //serialize the execution context and transport SerializationEngine serializer = new SerializationEngine(); client.Write(MessageType.EXECUTION_BEGIN, serializer.Serialize(executionContext)); return(true); }
private static void Generate2(string tempFile, SerializationEngine serializer, IReadOnlyList <TestClass> list, Action <Action <int> > loop) { Console.WriteLine($"Using {tempFile}"); using (var data = new FileAccessor(tempFile)) { CreateAndProcessFile(data, serializer, list, loop); } // close and reopen the file (rebuilds the index) ShowTimeIncludingOpsPerSec("rebuild index", () => { using (var data = new FileAccessor(tempFile)) { var lFile = new LowLevelAppendOnlyFile(data); } }); }
public RioSession(int sessionId, ISessionConfiguration configuration, RioCompletionQueue sendingCompletionQueue, RioCompletionQueue receivingCompletionQueue, SerializationEngine serializationEngine) { Id = sessionId; _configuration = configuration; _sendingCompletionQueue = sendingCompletionQueue; _receivingCompletionQueue = receivingCompletionQueue; _sendingBufferManager = RioBufferManager.Allocate(configuration.SendingBufferCount, _configuration.SendingBufferLength); _receivingBufferManager = RioBufferManager.Allocate(configuration.ReceivingBufferCount, _configuration.ReceivingBufferLength); _messageFramer = new MessageFramer(_receivingBufferManager); _threadLocalReceivingContext = new ThreadLocal <ReceivingContext>(() => new ReceivingContext(serializationEngine.Encoding)); _threadLocalSendingContext = new ThreadLocal <SendingContext>(() => new SendingContext(configuration, _sendingBufferManager, serializationEngine.Encoding)); _serializationEngine = serializationEngine; }
public void Deserialize(SerializationEngine engine, IPropertySymbol property, ITypeSymbol type, CodeWriter code, string name, string typeIdentifier, Location location) { var named = (INamedTypeSymbol)type; var types = named.TypeArguments; for (var idx = 0; idx < Items; idx++) { var item = idx + 1; var identifier = $"item{item}"; code.AppendLine($"{SerializationEngine.GetQualifiedName(types[idx])} {identifier};"); engine.AppendReadLogic(property, types[0], code, identifier, location); } code.AppendLine( $"{name} = new {typeIdentifier}({string.Join(", ", Enumerable.Range(1, Items).Select(self => $"item{self}"))});"); }
/// <summary> /// Deliver an assembly to this node. /// </summary> private void deliverAssembly(string assemblyFullName, byte[] assemblyArray, string domainKey) { if (!HasAssembly(assemblyFullName)) { loadedAssemblies.Add(assemblyFullName); } if (!loadedDomains.Contains(domainKey)) { loadedDomains.Add(domainKey); } //make sure we dont deliver the same assembly to ourselves if (NodeID != ClusterManager.NodeID) { SlaveAssembly slavePackage = new SlaveAssembly(assemblyArray, domainKey, assemblyFullName, ClusterManager.NodeID); SerializationEngine serializer = new SerializationEngine(); client.Write(MessageType.ASSEMBLY_TRANSFER_SLAVE, serializer.Serialize(slavePackage)); assemblyLoadReset.Reset(); } }
/// <summary> /// A dispatch event to be rasied upon reception of an assembly from another Presto server.. /// </summary> /// <param id="state">The server state object recieved along with this event.</param> private static void recieveAssemblySlave(ServerState state) { //get the slave assembly struct SerializationEngine serializer = new SerializationEngine(); SlaveAssembly slaveAssembly = (SlaveAssembly)serializer.Deserialize(state.GetDataArray()); //create the domain and add the assembly to it DomainManager.CreateDomain(slaveAssembly.DomainKey); if (!DomainManager.DomainHasAssembly(slaveAssembly.DomainKey, slaveAssembly.AssemblyName)) { DomainManager.LoadAssemblyIntoDomain(slaveAssembly.DomainKey, slaveAssembly.AssemblyImage); } Presto.Remote.Node from = Nodes.GetNodeByID(slaveAssembly.NodeID); if (from != null) { from.SetLoadedAssembly(slaveAssembly.AssemblyName); from.SetLoadedDomain(slaveAssembly.DomainKey); } //send back assembly transfer complete message state.Write(MessageType.ASSEMBLY_TRANSFER_COMPLETE); }
/// <summary> /// TODO The send message on ramp. /// </summary> /// <param name="bubblingTriggerConfiguration"> /// TODO The bubbling trigger configuration. /// </param> /// <param name="ehMessageType"> /// TODO The eh message type. /// </param> /// <param name="channelId"> /// TODO The channel id. /// </param> /// <param name="pointId"> /// TODO The point id. /// </param> /// <param name="properties"> /// TODO The properties. /// </param> public static void SendMessageOnRamp( object bubblingTriggerConfiguration, Configuration.MessageDataProperty ehMessageType, string channelId, string pointId, Dictionary <string, object> properties, string pointIdOverrided) { try { if (Configuration.RunLocalOnly()) { LogEngine.WriteLog(Configuration.EngineName, $"Impossible to send the message using a remote message storage provider, this GrabCaster point is configured for local only execution.", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Warning); return; } // Meter and measuring purpose var stopWatch = new Stopwatch(); stopWatch.Start(); byte[] serializedMessage = null; // Create EH data message if (ehMessageType != Configuration.MessageDataProperty.ByteArray) { serializedMessage = SerializationEngine.ObjectToByteArray(bubblingTriggerConfiguration); } else { serializedMessage = (byte[])bubblingTriggerConfiguration; } var messageId = Guid.NewGuid().ToString(); SkeletonMessage data = new SkeletonMessage(null); // IF > 256kb then persist if (serializedMessage.Length > secondaryPersistProviderByteSize && !secondaryPersistProviderEnabled) { LogEngine.WriteLog(Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name} - Impossible to send the message, the message body size if bigger than the secondaryPersistProviderByteSize paramenter but the secondaryPersistProviderEnabled is false.\rConsider to enable the secondaryPersistProviderEnabled paramanter in the config file and configure the storage component.", Constant.DefconOne, Constant.TaskCategoriesError, null, EventLogEntryType.Error); return; } if (serializedMessage.Length > secondaryPersistProviderByteSize && secondaryPersistProviderEnabled) { data.Body = Encoding.UTF8.GetBytes(messageId); ParametersCreateEventUpStream[0] = serializedMessage; ParametersCreateEventUpStream[1] = messageId; methodPersistEventToBlob.Invoke(classInstanceDpp, ParametersCreateEventUpStream); data.Properties.Add(Configuration.MessageDataProperty.Persisting.ToString(), true); } else { data.Body = serializedMessage; data.Properties.Add(Configuration.MessageDataProperty.Persisting.ToString(), false); } // Load custome Properties if (properties != null) { foreach (var prop in properties) { data.Properties.Add(prop.Key, prop.Value); } } data.Properties.Add(Configuration.MessageDataProperty.MessageId.ToString(), messageId); // Set main security subscription data.Properties.Add(Configuration.GrabCasterMessageTypeName, Configuration.GrabCasterMessageTypeValue); // Message context data.Properties.Add( Configuration.MessageDataProperty.Message.ToString(), Configuration.MessageDataProperty.Message.ToString()); data.Properties.Add(Configuration.MessageDataProperty.MessageType.ToString(), ehMessageType.ToString()); string senderid = pointIdOverrided != null? pointIdOverrided : Configuration.PointId(); data.Properties.Add(Configuration.MessageDataProperty.SenderId.ToString(), senderid); data.Properties.Add(Configuration.MessageDataProperty.SenderName.ToString(), Configuration.PointName()); data.Properties.Add( Configuration.MessageDataProperty.SenderDescriprion.ToString(), Configuration.PointDescription()); data.Properties.Add(Configuration.MessageDataProperty.ChannelId.ToString(), Configuration.ChannelId()); data.Properties.Add( Configuration.MessageDataProperty.ChannelName.ToString(), Configuration.ChannelName()); data.Properties.Add( Configuration.MessageDataProperty.ChannelDescription.ToString(), Configuration.ChannelDescription()); data.Properties.Add(Configuration.MessageDataProperty.ReceiverChannelId.ToString(), channelId); data.Properties.Add(Configuration.MessageDataProperty.ReceiverPointId.ToString(), pointId); stopWatch.Stop(); var ts = stopWatch.Elapsed; data.Properties.Add(Configuration.MessageDataProperty.OperationTime.ToString(), ts.Milliseconds); lock (offRampEngine) { if (ehMessageType == Configuration.MessageDataProperty.Event || ehMessageType == Configuration.MessageDataProperty.Trigger) { var bubblingEvent = (BubblingEvent)bubblingTriggerConfiguration; if (Configuration.LoggingVerbose()) { var serializedEvents = JsonConvert.SerializeObject( bubblingEvent.Events, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); LogEngine.ConsoleWriteLine( $"Sent Message Type {ehMessageType}sent - Endpoints: {serializedEvents}", ConsoleColor.Green); } else { LogEngine.ConsoleWriteLine($"Sent Message Type {ehMessageType}", ConsoleColor.Green); } } else { LogEngine.ConsoleWriteLine($"Sent Message Type {ehMessageType}", ConsoleColor.Green); } } offRampEngine.Enqueue(data); } catch (Exception ex) { LogEngine.WriteLog( Configuration.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.DefconOne, Constant.TaskCategoriesEventHubs, ex, EventLogEntryType.Error); } }