Exemple #1
0
 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));
 }
        private void RemoveSubscriptionMessageFromPht(string type, Uri uri)
        {
            subscriptionMessageIds.Write(writer =>
            {
                var key = new TypeAndUriKey
                {
                    TypeName = type,
                    Uri = uri
                };
                IList<int> messageIds;
                if (writer.TryGetValue(key, out messageIds) == false)
                    return;

                pht.Batch(actions =>
                {
                    foreach (var msgId in messageIds)
                    {
                        actions.RemoveItem(new RemoveItemRequest
                        {
                            Id = msgId,
                            Key = subscriptionsKey
                        });
                    }

                    actions.Commit();
                });
                writer.Remove(key);
            });
        }
        private void AddMessageIdentifierForTracking(int messageId, string messageType, Uri uri)
        {
            subscriptionMessageIds.Write(writer =>
            {
                var key = new TypeAndUriKey {TypeName = messageType, Uri = uri};
                IList<int> value;
                if (writer.TryGetValue(key, out value) == false)
                {
                    value = new List<int>();
                    writer.Add(key, value);
                }

                value.Add(messageId);
            });
        }
 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);
 }