Example #1
0
        public Task <CommandBusResult> EnqueueAsync(ICommand cmd)
        {
            Precondition.For(cmd, nameof(cmd)).IsValidCommand();

            if (condition == null || condition(cmd))
            {
                return(EnqueueInternalAsync(cmd));
            }

            return(Task.FromResult(CommandBusResult.Filtered()));
        }
Example #2
0
        public Task <CommandBusResult> EnqueueAsync(ICommand cmd)
        {
            Precondition.For(cmd, nameof(cmd)).IsValidCommand();

            var type = cmd.GetType();

            if (condition == null || condition(cmd))
            {
                logger.LogTrace("Sending \"{type}\" command.", type);
                return(EnqueueInternalAsync(cmd));
            }

            logger.LogTrace("Command \"{type}\" not set due to filter.", type);
            return(Task.FromResult(CommandBusResult.Filtered()));
        }