public static AggregateScenario <TAggregate> New <TAggregate>() where TAggregate : CommandAggregate { return(new AggregateScenario <TAggregate>(CreateAggregate <TAggregate>(), CommandAggregateHandler.New <TAggregate>())); }
public static DefaultAggregateDependencyFactory <TCommandAggregate> ForCommandAggregate <TCommandAggregate>(IConstructAggregates factory = null) where TCommandAggregate : CommandAggregate { var depFactory = new DefaultAggregateDependencyFactory <TCommandAggregate>(() => CommandAggregateHandler.New <TCommandAggregate>(factory)); if (factory != null) { depFactory.AggregateFactoryCreator = () => factory; } return(depFactory); }
public Process_actor_should_execute_async_processes_with_block(ITestOutputHelper output) { var logger = new XUnitAutoTestLoggerConfiguration(output).CreateLogger(); var creator = new AsyncLongRunningProcessManagerFactory(); _localAkkaEventBusTransport = Sys.InitLocalTransportExtension().Transport; var blackHole = Sys.ActorOf(BlackHoleActor.Props); var messageProcessActor = Sys.ActorOf(Props.Create(() => new HandlersPipeActor(new HandlersDefaultProcessor(), blackHole))); _processId = Guid.NewGuid().ToString(); var container = new ContainerBuilder(); container.Register <ProcessStateActor <TestState> >(c => new ProcessStateActor <TestState>(CommandAggregateHandler.New <ProcessStateAggregate <TestState> >(), new EachMessageSnapshotsPersistencePolicy(), AggregateFactory.Default, AggregateFactory.Default, messageProcessActor)); Sys.AddDependencyResolver(new AutoFacDependencyResolver(container.Build(), Sys)); Sys.AttachSerilogLogging(logger); //for process state retrival var processStateActor = Sys.ActorOf(Props.Create(() => new ProcessStateHubActor <TestState>(new DefaultRecycleConfiguration())), typeof(TestState).BeautyName() + "_Hub"); var name = EntityActorName.New <ProcessStateAggregate <TestState> >(_processId).Name; _processActor = ActorOfAsTestActorRef(() => new ProcessActor <TestState>(new AsyncLongRunningProcess(), creator), name); }
public ProcessStateDependencyFactory() : base(() => CommandAggregateHandler.New <ProcessStateAggregate <TState> >(), () => EmptyRouteMap.Instance) { }
public void Aggregate_actor_produce_fault_with_processId_from_command() { var command = new GoSleepCommand(null, null).CloneForProcess(Guid.NewGuid().ToString()); var transport = Sys.InitLocalTransportExtension().Transport; transport.Subscribe <MessageMetadataEnvelop <Fault <GoSleepCommand> > >(TestActor); var handlersActor = Sys.ActorOf(Props.Create(() => new HandlersPipeActor(new HandlersDefaultProcessor(), TestActor))); var actor = Sys.ActorOf(Props.Create(() => new AggregateActor <ProgrammerAggregate>(CommandAggregateHandler.New <ProgrammerAggregate>(null), new SnapshotsPersistencePolicy(1, null, 5, null), AggregateFactory.Default, AggregateFactory.Default, handlersActor)), EntityActorName.New <ProgrammerAggregate>(command.Id).Name); actor.Tell(new MessageMetadataEnvelop <ICommand>(command, MessageMetadata.New(command.Id, null, null))); var fault = FishForMessage <MessageMetadataEnvelop>(m => m.Message is Fault <GoSleepCommand>).Message as IFault; Assert.Equal(command.ProcessId, fault.ProcessId); }