public static Dictionary <ArtespActorsEnum, IActorRef> CreateValidadorPassagemExistenteChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ArtespActorsEnum, IActorRef> { { ArtespActorsEnum.GeradorPassagemAprovadaActor, context.ActorOf(Props.Create(() => new GeradorPassagemAprovadaArtespActor()), ActorsPath.GeradorPassagemAprovadaArtespActor.Name) }, { ArtespActorsEnum.GeradorPassagemReprovadaActor, context.ActorOf(Props.Create(() => new GeradorPassagemReprovadaArtespActor()), ActorsPath.GeradorPassagemReprovadaArtespActor.Name) }, { ArtespActorsEnum.GeradorPassagemInvalidaActor, context.ActorOf(Props.Create(() => new GeradorPassagemInvalidaArtespActor()), ActorsPath.GeradorPassagemInvalidaArtespActor.Name) }, { ArtespActorsEnum.ValidadorPassagemPendenteConcessionariaActor, context.ActorOf(Props.Create(() => new ValidadorPassagemPendenteConcessionariaArtespActor()), ActorsPath.ValidadorPassagemPendenteConcessionariaArtespActor.Name) } }; return(actors); }
public static Dictionary <ArtespActorsEnum, IActorRef> CreateValidadorPassagemPendenteConcessionariaChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ArtespActorsEnum, IActorRef> { { ArtespActorsEnum.GeradorPassagemReprovadaActor, context.ActorOf(Props.Create(() => new GeradorPassagemReprovadaArtespActor()), ActorsPath.GeradorPassagemReprovadaArtespActor.Name) }, { ArtespActorsEnum.GeradorPassagemInvalidaActor, context.ActorOf(Props.Create(() => new GeradorPassagemInvalidaArtespActor()), ActorsPath.GeradorPassagemInvalidaArtespActor.Name) }, { ArtespActorsEnum.ProcessadorPassagemAprovadaActor, context.ActorOf(Props.Create(() => new ProcessadorPassagemAprovadaArtespActor()), ActorsPath.ProcessadorPassagemAprovadaArtespActor.Name) }, { ArtespActorsEnum.IdentificadorPassagemAceiteManualReenvioActor, context.ActorOf(Props.Create(() => new IdentificadorPassagemAceiteManualReenvioArtespActor()), ActorsPath.IdentificadorPassagemAceiteManualReenvioArtespActor.Name) } }; return(actors); }
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 void CreateEntityViewActor <TEvent>(object action, ISystemProcess process, IProcessSystemMessage msg) where TEvent : IMessage { Type actorType = typeof(EntityViewDataServiceActor <>).MakeGenericType(typeof(TEvent)); var inMsg = new CreateEntityViewService(actorType, action, new StateCommandInfo(process.Id, RevolutionData.Context.Actor.Commands.StartActor), process, Source); EventMessageBus.Current.Publish(inMsg, Source); /// Create Actor Per Event try { Task.Run(() => { ctx.ActorOf( Props.Create(inMsg.ActorType, inMsg, msg) .WithRouter(new RoundRobinPool(1, new DefaultResizer(1, Environment.ProcessorCount, 1, .2, .3, .1, Environment.ProcessorCount))), "EntityViewDataServiceActor-" + typeof(TEvent).GetFriendlyName().Replace("<", "'").Replace(">", "'")); }); //_childActor.Tell(msg); } catch (Exception ex) { Debugger.Break(); EventMessageBus.Current.Publish(new ProcessEventFailure(failedEventType: inMsg.GetType(), failedEventMessage: inMsg, expectedEventType: typeof(ServiceStarted <>), exception: ex, source: Source, processInfo: new StateEventInfo(process.Id, RevolutionData.Context.Process.Events.Error)), Source); } }
public static IActorRef GetOrCreate <TActor>(this IUntypedActorContext context, string actorName) where TActor : ActorBase, new() { var actor = context.Child(actorName); return(actor.IsNobody() ? context.ActorOf(Props.Create(() => new TActor()), actorName) : actor); }
public void CreateEntityActor <TEvent>(object action, ISystemProcess process, IProcessSystemMessage msg) where TEvent : IMessage { /// Create Actor Per Event Type actorType = typeof(EntityDataServiceActor <>).MakeGenericType(typeof(TEvent)); var inMsg = new CreateEntityService(actorType, action, new StateCommandInfo(process.Id, RevolutionData.Context.Actor.Commands.StartActor), process, Source); try { Task.Run(() => { ctx.ActorOf( Props.Create(actorType, inMsg, msg) .WithRouter(new RoundRobinPool(1, new DefaultResizer(1, Environment.ProcessorCount, 1, .2, .3, .1, Environment.ProcessorCount))), "EntityDataServiceActor-" + typeof(TEvent).GetFriendlyName().Replace("<", "'").Replace(">", "'")); }); } catch (Exception ex) { //ToDo: This seems like a good way... getting the expected event type PublishProcesError(inMsg, ex, inMsg.ProcessInfo.State.ExpectedEvent.GetType()); } }
public virtual IActorRef Build(IUntypedActorContext context, string name) { return(context.ActorOf ( context.DI().Props <T>(), name )); }
public override IActorRef Build(IUntypedActorContext context, string name) { return(context.ActorOf ( context.DI().Props <Erc20BalanceIndexingActor>(), name )); }
public static IActorRef CreateActorHelper(IUntypedActorContext context, Props props, string actorName) { IActorRef actorRef = context.ActorOf(props, actorName); ColoredConsole.WriteCreationEvent($"CREATED '{actorName}' actor."); return(actorRef); }
public static Dictionary <ParkActorsEnum, IActorRef> CreateGerarPassagemParkChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ParkActorsEnum, IActorRef> { { ParkActorsEnum.ValidarPassagemParkActor, context.ActorOf(Props.Create(() => new ValidarPassagemParkActor()), ActorsPath.ValidarPassagemParkActor.Name) }, { ParkActorsEnum.GerarPassagemReprovadaParkActor, context.ActorOf(Props.Create(() => new GerarPassagemReprovadaParkActor()), ActorsPath.GerarPassagemReprovadaParkActor.Name) } }; return(actors); }
public static Dictionary <EdiActorsEnum, IActorRef> CreateValidadorPassagemEdiChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <EdiActorsEnum, IActorRef> { { EdiActorsEnum.GeradorPassagemReprovadaEdiActor, context.ActorOf(Props.Create(() => new GeradorPassagemReprovadaEdiActor()), ActorsPath.GeradorPassagemReprovadaEdiActor.Name) }, { EdiActorsEnum.ValidadorPassagemSistemaEdiActor, context.ActorOf(Props.Create(() => new ValidadorPassagemSistemaEdiActor()), ActorsPath.ValidadorPassagemSistemaEdiActor.Name) } }; return(actors); }
public static void CreateIfNotExists <TActor>(this Dictionary <string, IActorRef> actors, IUntypedActorContext context, string key) where TActor : ActorBase, new() { if (!actors.ContainsKey(key)) { IActorRef actorRef = context.ActorOf(Props.Create(() => new TActor()), key); actors.Add(key, actorRef); } }
public override IActorRef Build(IUntypedActorContext context, string name) { var router = new SmallestMailboxPool(_serviceSettings.NrOfTransactionMonitors); return(context.ActorOf ( context.DI().Props <TransactionMonitorActor>().WithRouter(router), name )); }
public IActorRef GetInstance(ActionType actionType) { IActorRef actor = null; switch (actionType) { case ActionType.Sum: actor = _untypedActorContext.ActorOf <SumActor>(); break; case ActionType.Avg: actor = _untypedActorContext.ActorOf <AvgActor>(); break; default: break; } return(actor); }
public static IActorRef ChildWithBackoffSupervision(this IUntypedActorContext context, Props childProps, string name, int minBackoff = 1, int maxBackoff = 3) { return(context.ActorOf( Props.Create(() => new BackoffSupervisor(childProps, name, TimeSpan.FromSeconds(minBackoff), TimeSpan.FromSeconds(maxBackoff), 0.1), SupervisorStrategy.StoppingStrategy))); }
protected virtual IActorRef FindOrCreate(string aggregateId, IUntypedActorContext context) { var aggregate = Context.Child(aggregateId); if (aggregate.IsNobody()) { aggregate = context.ActorOf(Props.Create(() => new Projector <TJournal, TProjection, TProjectionId, TProjectionContext>(aggregateId, _repository, _eventMap)), aggregateId); } return(aggregate); }
public static Dictionary <ArtespActorsEnum, IActorRef> CreateCoordinatorArtespChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ArtespActorsEnum, IActorRef> { { ArtespActorsEnum.IdentificadorPassagemActor, context.ActorOf(Props.Create(() => new IdentificadorPassagemArtespActor()), ActorsPath.IdentificadorPassagemArtespActor.Name) } }; return(actors); }
public static IActorRef ChildWithBackoffSupervision <T>(this IUntypedActorContext context, string name = nameof(T), int minBackoff = 1, int maxBackoff = 3) where T : ActorBase { var childProps = context.System.DI().Props <T>(); return(context.ActorOf( Props.Create(() => new BackoffSupervisor(childProps, name, TimeSpan.FromSeconds(minBackoff), TimeSpan.FromSeconds(maxBackoff), 0.1), SupervisorStrategy.StoppingStrategy))); }
public static Dictionary <ArtespActorsEnum, IActorRef> CreateGeradorPassagemInvalidaChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ArtespActorsEnum, IActorRef> { { ArtespActorsEnum.ProcessadorPassagemInvalidaActor, context.ActorOf(Props.Create(() => new ProcessadorPassagemInvalidaArtespActor()), ActorsPath.ProcessadorPassagemInvalidaArtespActor.Name) } }; return(actors); }
public static Dictionary <ParkActorsEnum, IActorRef> CreateCoordinatorParkChildrenActors( IUntypedActorContext context) { var actors = new Dictionary <ParkActorsEnum, IActorRef> { { ParkActorsEnum.ValidarPassagemPendenteParkActor, context.ActorOf(Props.Create(() => new ValidarPassagemPendenteParkActor()), ActorsPath.ValidarPassagemPendenteParkActor.Name) } }; return(actors); }
private void CreateProcesses(IUser user, IEnumerable <IProcessInfo> processSteps, int processId) { Parallel.ForEach( processSteps.Select( p => new CreateProcessActor(ProcessComplexEvents.Where(x => x.ProcessId == processId).ToList(), new StateCommandInfo(p.Id, RevolutionData.Context.Actor.Commands.CreateActor), new SystemProcess( new RevolutionEntities.Process.Process(p.Id, p.ParentProcessId, p.Name, p.Description, p.Symbol, user), Source.MachineInfo), Source)), new ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount }, (inMsg) => { try { var actorName = "ProcessActor-" + inMsg.Process.Name.GetSafeActorName(); if (!existingProcessActors.TryAdd(actorName, actorName)) { return; } EventMessageBus.Current.Publish(inMsg, Source); if (ProcessComplexEvents.All(x => x.ProcessId != inMsg.Process.Id)) { throw new ApplicationException( $"No Complex Events were created for this process:{inMsg.Process.Id}-{inMsg.Process.Name}"); } Task.Run(() => { ctx.ActorOf(Props.Create <ProcessActor>(inMsg), actorName); }) .ConfigureAwait(false); } catch (Exception ex) { Debugger.Break(); EventMessageBus.Current.Publish(new ProcessEventFailure(failedEventType: inMsg.GetType(), failedEventMessage: inMsg, expectedEventType: typeof(SystemProcessStarted), exception: ex, source: Source, processInfo: new StateEventInfo(inMsg.Process.Id, RevolutionData.Context.Process.Events.Error)), Source); } }); }
public static Dictionary <ArtespActorsEnum, IActorRef> CreateValidadorDivergenciaCategoriaPassagemChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ArtespActorsEnum, IActorRef> { { ArtespActorsEnum.GeradorPassagemReprovadaActor, context.ActorOf(Props.Create(() => new GeradorPassagemReprovadaArtespActor()), ActorsPath.GeradorPassagemReprovadaArtespActor.Name) }, { ArtespActorsEnum.GeradorPassagemInvalidaActor, context.ActorOf(Props.Create(() => new GeradorPassagemInvalidaArtespActor()), ActorsPath.GeradorPassagemInvalidaArtespActor.Name) }, { ArtespActorsEnum.GeradorPassagemAprovadaActor, context.ActorOf(Props.Create(() => new GeradorPassagemAprovadaArtespActor()), ActorsPath.GeradorPassagemAprovadaArtespActor.Name) } }; return(actors); }
public static Dictionary <ArtespActorsEnum, IActorRef> CreateValidadorPassagemSistemaAceiteManualReenvioChildrenActors(IUntypedActorContext context) { var actors = new Dictionary <ArtespActorsEnum, IActorRef> { { ArtespActorsEnum.GeradorPassagemReprovadaActor, context.ActorOf(Props.Create(() => new GeradorPassagemReprovadaArtespActor()), ActorsPath.GeradorPassagemReprovadaArtespActor.Name) }, { ArtespActorsEnum.GeradorPassagemInvalidaActor, context.ActorOf(Props.Create(() => new GeradorPassagemInvalidaArtespActor()), ActorsPath.GeradorPassagemInvalidaArtespActor.Name) }, { ArtespActorsEnum.ValidadorPassagemValePedagioActor, context.ActorOf(Props.Create(() => new ValidadorPassagemValePedagioArtespActor()), ActorsPath.ValidadorPassagemValePedagioArtespActor.Name) } }; return(actors); }
private void BotOnMessageReceived(object sender, MessageEventArgs e) { long id = e.Message.Chat.Id; var childName = "User" + id; var child = ThisContext.Child(childName); if (child == ActorRefs.Nobody) { var props = Props.Create(() => new User()); child = ThisContext.ActorOf(props, childName); } child.Tell(e.Message); }
public static IActorRef CreateActor(IUntypedActorContext context, Type actorType, string name) { var actorName = actorType.Name + "." + name; var actor = context.Child(actorName); if (!actor.Equals(ActorRefs.Nobody)) { return(actor); } var actorProps = context.DI().Props(actorType); actor = context.ActorOf(actorProps, actorName); return(actor); }
public BotActor() { ThisContext = Context; Bot.OnMessage += BotOnMessageReceived; Bot.OnMessageEdited += BotOnMessageReceived; Bot.OnCallbackQuery += BotOnCallbackQueryReceived; Bot.OnInlineQuery += BotOnInlineQueryReceived; Bot.OnInlineResultChosen += BotOnChosenInlineResultReceived; Bot.OnReceiveError += BotOnReceiveError; MqttActor = ThisContext.ActorOf(Props.Create(() => new MqttActor()), "MqttActor"); MqttActor.Tell(new MqttActorMessage.Start()); MqttActor.Tell(new MqttActorMessage.Subscribe(DeviceStatus)); MqttActor.Tell(new MqttActorMessage.Subscribe(LightStatus)); Receive <BotActorMessage.Start>(StartReceived, null); Receive <BotActorMessage.Stop>(StopReceived, null); Receive <BotActorMessage.SendTextMessage>(SendTextMessageReceived, null); Receive <MqttActorMessage.PayloadReceived>(MqttPayloadReceived, null); }
public ViewModelSupervisor(List <IViewModelInfo> processViewModelInfos, ISystemProcess process, ISystemStarted firstMsg) : base(process) { ProcessViewModelInfos = processViewModelInfos; ctx = Context; Task.Run(() => { ctx.ActorOf( Props.Create <ViewModelActor>(process) .WithRouter(new RoundRobinPool(1, new DefaultResizer(1, Environment.ProcessorCount, 1, .2, .3, .1, Environment.ProcessorCount))), "ViewModelActorEntityActor"); }); EventMessageBus.Current.GetEvent <ISystemProcessStarted>(Source).Subscribe(x => HandleProcessViews(x)); EventMessageBus.Current.GetEvent <IServiceStarted <IViewModelService> >(Source).Subscribe(x => { EventMessageBus.Current.Publish(new ServiceStarted <IViewModelSupervisor>(this, new StateEventInfo(process.Id, RevolutionData.Context.Actor.Events.ActorStarted), process, Source), Source); }); //HandleProcessViews(firstMsg); }
public void CreateNotebook(IUntypedActorContext context, DirectoryInfo directory) { var actor = context.ActorOf(ActorRegistry.Notebook); CreateNotebook(actor, directory); }
public static IActorRef ActorOf(this IUntypedActorContext context, ActorMetadata actor) { return(context.ActorOf(context.DI().Props(actor.ActorType), actor.Name)); }
/// <summary> /// Requires RemoteActorViewerActorAddress to be in app config in order to call CreateActorInDebugMode //todo : pass address from here /// </summary> public static IActorRef CreateActorInDebugMode <TActorType>(this IUntypedActorContext context, ActorSetUpOptions options = null, Action <object> messageLogger = null, string debugerPrefix = "DEBUG_") where TActorType : ActorBase { var actorName = typeof(TActorType).Name; return(context.ActorOf(Props.Create(() => new MainDebugModeActor(GetActorProps <TActorType>(context.System, options), debugerPrefix + actorName, messageLogger)), actorName)); }
public void CreateNotebook(IUntypedActorContext context, DirectoryInfo directory) { var actor = context.ActorOf(ActorRegistry.Notebook); CreateNotebook(actor, directory); }