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); }
/// <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(); }
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(); }