예제 #1
0
        public static AmqpRuleDescription GetRuleDescription(RuleDescription description)
        {
            AmqpFilter     filter     = MessageConverter.GetFilter(description.Filter);
            AmqpRuleAction ruleAction = MessageConverter.GetRuleAction(description.Action);

            return(new AmqpRuleDescription()
            {
                Filter = filter,
                Action = ruleAction
            });
        }
예제 #2
0
        private static RuleAction GetRuleAction(AmqpRuleAction amqpAction)
        {
            RuleAction @default;

            if (amqpAction.DescriptorCode != AmqpEmptyRuleAction.Code)
            {
                if (amqpAction.DescriptorCode != AmqpSqlRuleAction.Code)
                {
                    throw new NotSupportedException();
                }
                AmqpSqlRuleAction amqpSqlRuleAction = (AmqpSqlRuleAction)amqpAction;
                @default = (!amqpSqlRuleAction.CompatibilityLevel.HasValue ? new SqlRuleAction(amqpSqlRuleAction.SqlExpression) : new SqlRuleAction(amqpSqlRuleAction.SqlExpression, amqpSqlRuleAction.CompatibilityLevel.Value));
            }
            else
            {
                @default = EmptyRuleAction.Default;
            }
            return(@default);
        }
예제 #3
0
        private static AmqpRuleAction GetRuleAction(RuleAction ruleAction)
        {
            AmqpRuleAction amqpEmptyRuleAction = null;

            if (ruleAction == null || ruleAction is EmptyRuleAction)
            {
                amqpEmptyRuleAction = new AmqpEmptyRuleAction();
            }
            else
            {
                if (!(ruleAction is SqlRuleAction))
                {
                    throw new NotSupportedException();
                }
                AmqpSqlRuleAction amqpSqlRuleAction = new AmqpSqlRuleAction();
                SqlRuleAction     sqlRuleAction     = (SqlRuleAction)ruleAction;
                amqpSqlRuleAction.SqlExpression      = sqlRuleAction.SqlExpression;
                amqpSqlRuleAction.CompatibilityLevel = new int?(sqlRuleAction.CompatibilityLevel);
                amqpEmptyRuleAction = amqpSqlRuleAction;
            }
            return(amqpEmptyRuleAction);
        }