コード例 #1
0
        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);
            });
        }
コード例 #2
0
        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);
            });
        }
コード例 #3
0
        private void RemoveSubscriptionMessageFromStorage(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;
                }

                storage.RemoveItems(SubscriptionsKey + localEndpoint, messageIds);

                writer.Remove(key);
            });
        }
コード例 #4
0
 private void RemoveSubscriptionMessageFromQueue(OpenedQueue 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);
     });
 }
コード例 #5
0
        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);
                }

                if (string.IsNullOrEmpty(messageId))
                {
                    throw new ArgumentException("messageId must have value");
                }

                value.Add(messageId);
            });
        }
コード例 #6
0
 private void RemoveSubscriptionMessageFromQueue(OpenedQueue 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);
      });
 }
コード例 #7
0
        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);
                }

                if(string.IsNullOrEmpty(messageId))
                    throw new ArgumentException("messageId must have value");

                value.Add(messageId);
            });
        }