Esempio n. 1
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);
        }
Esempio n. 2
0
 /// <summary>
 /// Decodes a timestamp from the buffer and advances the buffer's position.
 /// </summary>
 /// <param name="buffer">The buffer to read.</param>
 /// <returns>A timestamp.</returns>
 public static DateTime?DecodeTimeStamp(ByteBuffer buffer)
 {
     return(TimeStampEncoding.Decode(buffer, 0));
 }
Esempio n. 3
0
 /// <summary>
 /// Encodes a timestamp and appends the bytes to the buffer.
 /// </summary>
 /// <param name="data">The timestamp.</param>
 /// <param name="buffer">The destination buffer.</param>
 public static void EncodeTimeStamp(DateTime?data, ByteBuffer buffer)
 {
     TimeStampEncoding.Encode(data, buffer);
 }
Esempio n. 4
0
 /// <summary>
 /// Gets the encode size of a timestamp.
 /// </summary>
 /// <param name="value">The timestamp.</param>
 /// <returns>Encode size in bytes of the timestamp.</returns>
 public static int GetTimeStampEncodeSize(DateTime?value)
 {
     return(TimeStampEncoding.GetEncodeSize(value));
 }