private void AddMessageIdentifierForTracking(string messageId, string messageType, Uri uri) { subscriptionMessageIds.Write(writer => { var key = new TypeAndUriKey { TypeName = messageType, Uri = uri }; IList<string> value; if (writer.TryGetValue(key, out value) == false) { value = new List<string>(); writer.Add(key, value); } value.Add(messageId); }); }
private void RemoveSubscriptionMessageFromQueue(MessageQueue queue, string type, Uri uri) { subscriptionMessageIds.Write(writer => { var key = new TypeAndUriKey { TypeName = type, Uri = uri }; IList<string> messageIds; if (writer.TryGetValue(key, out messageIds) == false) return; foreach (var msgId in messageIds) { queue.ConsumeMessage(msgId); } writer.Remove(key); }); }
public bool Equals(TypeAndUriKey obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return Equals(obj.TypeName, TypeName) && Equals(obj.Uri, Uri); }