public void Run1() { Console.WriteLine("Press 'Enter' to send a message to create a new Aggregate.To exit, Ctrl + C"); Console.ReadLine(); Bus.Send("ServerQueue", new CommandMessage { Payload = new CreateSomeObjectCommand { ObjectId = AggregateId } }); string line; while ((line = Console.ReadLine()) != null) { ICommand payload = new DoSomethingCommand { Value = line, ObjectId = AggregateId }; var command = new CommandMessage { Payload = payload }; Bus.Send("ServerQueue", command); } }
public async Task <ICommandResult <string> > Handle(DoSomethingCommand command, CancellationToken cancellationToken) { await Task.Delay(1000, cancellationToken); _log.LogInformation("Thing {Thing} done", command.ThingToDo); return(new CommandResult <string>(CommandStatus.Ok, "world!")); }
public void ShouldSetOtputIfThePropertyExists() { var commandWithOutput = new DoSomethingCommand(); var output = new MemoryOutput(); var result = CommandMetaDataHelper.SetOutputProperty(commandWithOutput, output); Assert.IsTrue(result); }
public async Task <IActionResult> DoSomething(string id) { var cmd = new DoSomethingCommand(Guid.Parse(id)); await _dispatcher.DispatchAsync(cmd); await _unitOfWork.CommitAsync(); return(Ok(cmd)); }
public async Task <IActionResult> DoSomething(string id) { var cmd = new DoSomethingCommand(Guid.Parse(id)); var response = await _dispatcher.DispatchAsync <DoSomethingCommand, DoSomethingResponse>(cmd); await _session.CommitAsync(); return(Ok(response)); }
public void Handle(DoSomethingCommand message) { _log.WarnFormat("Handled DoSomethingCommand, message.SagaId={0}, SagaId={1}", message.SagaId, Data.Id); Data.SagaId = message.SagaId; var forwardSagaMessage = new ForwardSagaMessage { SagaId = Data.Id }; _log.WarnFormat("Sending ForwardSagaMessage, SagaId={0}", forwardSagaMessage.SagaId); Bus.SendLocal(forwardSagaMessage); }
public void WillSerializeCommands() { var command = new DoSomethingCommand { Name = "Test", NumberOfTimes = 1 }; var builder = new StringWriter(); var sut = new JsonCommandSerializer(builder); sut.Inspect(command); Console.WriteLine(builder); }
public void Handle(ForwardMessage message) { _log.WarnFormat("Handled ForwardMessage, AccountId={0}, SagaId={1}", message.AccountId, Data.Id); var doSomethingCommand = new DoSomethingCommand { SagaId = Data.Id }; _log.WarnFormat("Sending DoSomethingCommand, SagaId={0}", doSomethingCommand.SagaId); Bus.Send(doSomethingCommand); var doSomethingElseCommand = new DoSomethingElseCommand { SagaId = Data.Id }; _log.WarnFormat("Sending DoSomethingElseCommand, SagaId={0}", doSomethingElseCommand.SagaId); Bus.Send(doSomethingElseCommand); }
public Foo(DoSomethingCommand doSomethingCommand) { _doSomethingCommand = doSomethingCommand; }
public virtual void DoSomethingHandler(DoSomethingCommand command) { this.DoSomething(command.Sender as TestViewModel); }
public void Handle(DoSomethingCommand command, CancellationToken cancellationToken) { base.Handle(command); }
public async void DoSomething(DoSomethingCommand command) { // Method signature is not allowed. await Task.Delay(1); }
public void DoSomething(DoSomethingCommand command) { base.Handle(command); }
public ImageListItemViewModel() { DoSomethingCommand = new DoSomethingCommand(); DoSomethingElseCommand = new DoSomethingElseCommand(); }
public ViewModel() { DoSomethingCommand = ReactiveCommand.CreateFromTask(DoSomethingAsync); DoSomethingCommand.Subscribe(_ => { this.Message = "Finished"; }); }
public virtual void ExecuteDoSomething(DoSomethingCommand command) { command.Sender = Test; Test.DoSomething.OnNext(command); }