public async Task Handle(CupcakeOrderPackagedEvent boxedEvent,CancellationToken cancellationToken) { Console.WriteLine($"Hanlding event - {nameof(CupcakeOrderPackagedEvent)} "); //Serialize string serializedOrder = JsonConvert.SerializeObject(boxedEvent.Order); var producer = new ProducerWrapper(this._config,"readytoship"); await producer.writeMessage(serializedOrder); }
public async Task <bool> Handle(MarkOrderStatusAsPackagedCommand cmd, CancellationToken cancellationToken) { //TODO::Verify if there is any order request with the input order // If no, reject command //Create required events for this action and publish them var boxedEvent = new CupcakeOrderPackagedEvent(cmd.Order); await _mediator.Publish(boxedEvent); return(true); //send acknowledgement as "true"(command accepted) }