예제 #1
0
        private void OnPurged(CachedEventHubMessage lastItemPurged)
        {
            int readOffset = 0;

            SegmentBuilder.ReadNextString(lastItemPurged.Segment, ref readOffset);                 // read namespace, not needed so throw away.
            string offset = SegmentBuilder.ReadNextString(lastItemPurged.Segment, ref readOffset); // read offset

            checkpoint.Update(offset, DateTime.UtcNow);
        }
예제 #2
0
        /// <summary>
        /// Duplicate of EventHub's EventData class.
        /// </summary>
        /// <param name="cachedMessage"></param>
        public EventHubMessage(CachedEventHubMessage cachedMessage)
        {
            int readOffset = 0;

            StreamIdentity = new StreamIdentity(cachedMessage.StreamGuid, SegmentBuilder.ReadNextString(cachedMessage.Segment, ref readOffset));
            Offset         = SegmentBuilder.ReadNextString(cachedMessage.Segment, ref readOffset);
            PartitionKey   = SegmentBuilder.ReadNextString(cachedMessage.Segment, ref readOffset);
            SequenceNumber = cachedMessage.SequenceNumber;
            EnqueueTimeUtc = cachedMessage.EnqueueTimeUtc;
            DequeueTimeUtc = cachedMessage.DequeueTimeUtc;
            Properties     = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset).DeserializeProperties();
            Payload        = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset).ToArray();
        }
예제 #3
0
        public EventHubMessage(CachedEventHubMessage cachedMessage)
        {
            int readOffset = 0;

            StreamIdentity = new StreamIdentity(cachedMessage.StreamGuid, SegmentBuilder.ReadNextString(cachedMessage.Segment, ref readOffset));
            Offset         = SegmentBuilder.ReadNextString(cachedMessage.Segment, ref readOffset);
            SequenceNumber = cachedMessage.SequenceNumber;
            EnqueueTimeUtc = cachedMessage.EnqueueTimeUtc;
            DequeueTimeUtc = cachedMessage.DequeueTimeUtc;
            Properties     = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset).DeserializeProperties();
            object offsetObj;

            PartitionKey = Properties.TryGetValue("PartitionKey", out offsetObj)
                ? offsetObj as string
                : default(string);
            Payload = SegmentBuilder.ReadNextBytes(cachedMessage.Segment, ref readOffset).ToArray();
        }