internal static void PublishProcesError(IProcessSystemMessage msg, Exception ex, Type expectedMessageType) { var outMsg = new ProcessEventFailure(failedEventType: msg.GetType(), failedEventMessage: msg, expectedEventType: expectedMessageType, exception: ex, source: Source, processInfo: new StateEventInfo(msg.Process.Id, RevolutionData.Context.Process.Events.Error)); Logger.Log(LoggingLevel.Error, $"Error:ProcessId:{msg.ProcessInfo.ProcessId}, ProcessStatus:{msg.ProcessInfo.State.Status}, ExceptionMessage: {ex.Message}|||| {ex.StackTrace}"); EventMessageBus.Current.Publish(outMsg, Source); }
private void HandleProcessViews(IProcessSystemMessage pe) { try { Parallel.ForEach(ProcessViewModelInfos.Where(x => x.ProcessId == pe.Process.Id), new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }, (v) => { var msg = new LoadViewModel(v, new StateCommandInfo(pe.Process.Id, RevolutionData.Context.ViewModel.Commands.LoadViewModel), pe.Process, Source); EventMessageBus.Current.Publish(msg, Source); }); } catch (Exception ex) { //todo: need to fix this PublishProcesError(pe, ex, pe.GetType()); } }
private void CreateEntityViewActors(Type classType, Type genericListType, string actorName, ISystemProcess process, IProcessSystemMessage msg) { var child = ctx.Child(string.Format(actorName, classType.Name)); if (!Equals(child, ActorRefs.Nobody)) { return; } var specificListType = genericListType.MakeGenericType(classType); try { Task.Run(() => { ctx.ActorOf(Props.Create(specificListType, process, msg), string.Format(actorName, classType.Name)); }).ConfigureAwait(false); } catch (Exception ex) { Debugger.Break(); EventMessageBus.Current.Publish(new ProcessEventFailure(failedEventType: msg.GetType(), failedEventMessage: msg, expectedEventType: typeof(ServiceStarted <>).MakeGenericType(specificListType), exception: ex, source: Source, processInfo: new StateEventInfo(msg.Process.Id, RevolutionData.Context.Process.Events.Error)), Source); } }
public static Dictionary <string, string> GetDerivedProperties(this IProcessSystemMessage msg) { FieldInfo[] fields = msg.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); return(fields.ToDictionary(f => f.Name, f => new JavaScriptSerializer().Serialize(f.GetValue(msg)))); }