Пример #1
0
        private async Task <bool> PassesDispatchCriteria(MessageDispatchInfo dispatchInfo, IMessage message)
        {
            ScriptPredicate predicate = dispatchInfo.Predicate;

            if (predicate != null)
            {
                return(await _scriptingSrv.SatisfiesPredicate(message, predicate));
            }

            return(dispatchInfo.IsMatch(message));
        }
Пример #2
0
        private Task InvokeDispatcher(MessageDispatchInfo dispatcher, IMessage message, CancellationToken cancellationToken)
        {
            var consumer = (IMessageConsumer)_lifetimeScope.Resolve(dispatcher.ConsumerType);

            return(dispatcher.Dispatch(message, consumer, cancellationToken));
        }