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

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