Esempio n. 1
0
        public async Task HandleCommand(IActionableMessage <ICommand> command)
        {
            try
            {
                var evt = await Handle((TCommand)command.ReceivedCommand);

                await SaveEvent(evt);
            }
            catch (Exception ex)
            {
                // TODO: Log here
                await command.Reject("Exception", ex.Message);
            }

            await command.Complete();
        }
Esempio n. 2
0
        public async Task HandleCommand(IActionableMessage <ICommand> command)
        {
            try
            {
                var evt = await Handle((TCommand)command.ReceivedCommand);

                // TODO: Atomicity a bit lost here - saving of event and completion of queue message should be atomic
                await AggregateWriter.Save(evt);
            }
            catch (Exception ex)
            {
                // TODO: Log here
                await command.Reject("Exception", ex.Message);
            }

            await command.Complete();
        }