Beispiel #1
0
 public async Task Handle(CupcakeOrderBatterMixedEvent mixedEvent,CancellationToken cancellationToken)
 {
    Console.WriteLine($"Hanlding event - {nameof(CupcakeOrderBatterMixedEvent)} ");
    //Serialize 
     string serializedOrder = JsonConvert.SerializeObject(mixedEvent.Order);
     var producer = new ProducerWrapper(this._config,"readytobake");
     await producer.writeMessage(serializedOrder);
 }
Beispiel #2
0
        public async Task <bool> Handle(MarkOrderStatusAsMixedCommand 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 mixedEvent = new CupcakeOrderBatterMixedEvent(cmd.Order);
            await _mediator.Publish(mixedEvent);

            return(true); //send acknowledgement as "true"(command accepted)
        }