Пример #1
0
        /// <summary>
        /// SubscribeWithGroup
        /// </summary>
        /// <returns></returns>
        public IEnumerable <StreamEntry> SubscribeWithGroup()
        {
            if (!_inited)
            {
                CreateGroup();
                _inited = true;
            }
            var data = _redisQueue.Subscribe(_groupName, _consumerName, _topicName, string.IsNullOrEmpty(_redisId) ? null : new RedisID(_redisId), _noAck, _count, _blocked, _timeout);

            if (_autoCommit)
            {
                var ids = new List <RedisID>();

                foreach (var item in data)
                {
                    var ilist = item.IdFileds;

                    foreach (var sitem in ilist)
                    {
                        ids.Add(sitem.RedisID);
                    }
                }
                Commit(ids);
            }
            return(data);
        }
Пример #2
0
 /// <summary>
 /// Subscribe
 /// </summary>
 /// <returns></returns>
 public IEnumerable <StreamEntry> Subscribe()
 {
     return(_redisQueue.Subscribe(_topicIDs, _count, _blocked, _timeout));
 }