Module: Redis::Stream::Inspect
- Included in:
- Client
- Defined in:
- lib/redis/stream/inspect.rb
Instance Method Summary collapse
- #consumers(group = @group) ⇒ Object
- #del_consumer(group = @group, consumer = @consumer_id) ⇒ Object
- #del_group(group = @group) ⇒ Object
- #groups ⇒ Object
- #info ⇒ Object
- #pending_messages ⇒ Object
Instance Method Details
#consumers(group = @group) ⇒ Object
20 21 22 23 24 |
# File 'lib/redis/stream/inspect.rb', line 20 def consumers(group = @group) @redis_pool.with do |redis| redis.xinfo("consumers", @stream, group) end end |
#del_consumer(group = @group, consumer = @consumer_id) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/redis/stream/inspect.rb', line 26 def del_consumer(group = @group, consumer = @consumer_id) @logger.info("#{@consumer_id} - deleting consumer #{group}-#{consumer}") @redis_pool.with do |redis| redis.xgroup('DELCONSUMER', @stream, group, consumer) end end |
#del_group(group = @group) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/redis/stream/inspect.rb', line 33 def del_group(group = @group) if consumers(group).length == 0 && groups.map { |m| m["name"] }.include?(group) @logger.info("#{@consumer_id} - deleting group #{group}") @redis_pool.with do |redis| redis.xgroup('DESTROY', @stream, group) end end end |
#groups ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/redis/stream/inspect.rb', line 5 def groups @redis_pool.with do |redis| redis.xinfo("groups", @stream) end rescue Exception => e @logger.error("#{@consumer_id} - #{e.}") {} end |
#info ⇒ Object
14 15 16 17 18 |
# File 'lib/redis/stream/inspect.rb', line 14 def info @redis_pool.with do |redis| redis.xinfo("stream", @stream) end end |
#pending_messages ⇒ Object
42 43 44 45 46 |
# File 'lib/redis/stream/inspect.rb', line 42 def @redis_pool.with do |redis| redis.xrange(@stream) end end |