Exemple #1
0
        public static RuleDescription GetRuleDescription(AmqpRuleDescription amqpDescription)
        {
            Filter     filter     = MessageConverter.GetFilter(amqpDescription.Filter);
            RuleAction ruleAction = MessageConverter.GetRuleAction(amqpDescription.Action);

            return(new RuleDescription(filter)
            {
                Action = ruleAction
            });
        }
Exemple #2
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
            });
        }
Exemple #3
0
        private IList <AmqpDescribed> CreateFilters()
        {
            string str;

            if (string.IsNullOrWhiteSpace(this.StartOffset) && !this.ReceiverStartTime.HasValue && base.Filter == null)
            {
                return(null);
            }
            List <AmqpDescribed> amqpDescribeds = null;

            if (base.Filter != null)
            {
                amqpDescribeds = new List <AmqpDescribed>()
                {
                    MessageConverter.GetFilter(base.Filter)
                };
            }
            if (base.Mode == ReceiveMode.ReceiveAndDelete && (!string.IsNullOrWhiteSpace(this.StartOffset) || this.ReceiverStartTime.HasValue))
            {
                if (amqpDescribeds == null)
                {
                    amqpDescribeds = new List <AmqpDescribed>();
                }
                if (string.IsNullOrWhiteSpace(this.StartOffset))
                {
                    CultureInfo invariantCulture  = CultureInfo.InvariantCulture;
                    object[]    milliseconds      = new object[1];
                    DateTime?   receiverStartTime = this.ReceiverStartTime;
                    milliseconds[0] = TimeStampEncoding.GetMilliseconds(receiverStartTime.Value);
                    str             = string.Format(invariantCulture, "amqp.annotation.x-opt-enqueuedtimeutc > {0}", milliseconds);
                }
                else if (this.OffsetInclusive)
                {
                    CultureInfo cultureInfo = CultureInfo.InvariantCulture;
                    object[]    startOffset = new object[] { this.StartOffset };
                    str = string.Format(cultureInfo, "amqp.annotation.x-opt-offset >= '{0}'", startOffset);
                }
                else
                {
                    CultureInfo invariantCulture1 = CultureInfo.InvariantCulture;
                    object[]    objArray          = new object[] { this.StartOffset };
                    str = string.Format(invariantCulture1, "amqp.annotation.x-opt-offset > '{0}'", objArray);
                }
                amqpDescribeds.Add(new AmqpSelectorFilter(str));
            }
            return(amqpDescribeds);
        }