// Determines if the message should be delivered to the queue.  If the exchange is marked
        // with a predicate attribute, the corresponding externally named script is executed to
        // determine if the message has passing criteria.  If no external script is specified,
        // the exchange's Satisfies method is called.
        private async Task <bool> SatisfiesExchangeCriteria(MessageExchangeDefinition exchangeDef, IMessage message)
        {
            ScriptPredicate predicate = exchangeDef.Exchange.Settings.Predicate;

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

            return(exchangeDef.Exchange.Satisfies(message));
        }
Esempio n. 2
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));
        }