Beispiel #1
0
        /// <summary>设置消费组。如果消费组不存在则创建</summary>
        /// <param name="group"></param>
        /// <returns></returns>
        public Boolean SetGroup(String group)
        {
            if (group.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(group));
            }

            Group = group;

            // 如果Stream不存在,则直接创建消费组,此时会创建Stream
            if (!Redis.ContainsKey(Key))
            {
                return(GroupCreate(group));
            }

            var gs = GetGroups();

            if (gs == null || !gs.Any(e => e.Name == group))
            {
                return(GroupCreate(group));
            }

            return(false);
        }