Beispiel #1
0
 public bool Subscription_EnsureUniqueDelivery(
     string _Topic,
     string _TimestampHash,
     Action <string> _ErrorMessageAction)
 {
     if (_TimestampHash != null && EnsurerMemoryService != null && PubSubService != null && BCommonUtilities.BUtility.CalculateStringMD5(_Topic, out string HashedTopic, _ErrorMessageAction))
     {
         var QueryParameters = new BMemoryQueryParameters()
         {
             Domain     = "PubSubEnsureUniqueDelivery",
             SubDomain  = HashedTopic,
             Identifier = _TimestampHash
         };
         var bSuccessfullyDeleted = EnsurerMemoryService.DeleteKey(QueryParameters, "Publish", _ErrorMessageAction, false /* Do not publish */);
         return(bSuccessfullyDeleted);
     }
     return(true);
 }
Beispiel #2
0
 public static bool CreateFrom(out BMemoryQueryParameters Result, string SplitFrom)
 {
     if (SplitFrom != null && SplitFrom.Length > 0)
     {
         string[] Splitted = SplitFrom.Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries);
         if (Splitted != null && Splitted.Length >= 3)
         {
             Result = new BMemoryQueryParameters()
             {
                 Domain     = Splitted[0],
                 SubDomain  = Splitted[1],
                 Identifier = Splitted[2]
             };
             return(true);
         }
     }
     Result = new BMemoryQueryParameters();
     return(false);
 }
Beispiel #3
0
        public bool Publish_EnsureUniqueDelivery(
            string _Topic,
            string _TimestampHash,
            Action <string> _ErrorMessageAction)
        {
            if (EnsurerMemoryService != null && PubSubService != null && BCommonUtilities.BUtility.CalculateStringMD5(_Topic, out string HashedTopic, _ErrorMessageAction))
            {
                var QueryParameters = new BMemoryQueryParameters()
                {
                    Domain     = "PubSubEnsureUniqueDelivery",
                    SubDomain  = HashedTopic,
                    Identifier = _TimestampHash
                };

                if (EnsurerMemoryService.SetKeyValue(QueryParameters, new Tuple <string, BCommonUtilities.BPrimitiveType>[] { new Tuple <string, BCommonUtilities.BPrimitiveType>("Publish", new BCommonUtilities.BPrimitiveType("Message")) }, _ErrorMessageAction, false /* Do not publish */))
                {
                    EnsurerMemoryService.SetKeyExpireTime(QueryParameters, TimeSpan.FromSeconds(60), _ErrorMessageAction);
                }
            }
            return(true);
        }