@@ -3262,29 +3262,38 @@ public Task<RedisStream[]> StreamReadAsync(StreamPosition[] streamPositions, int
32623262 return ExecuteAsync ( msg , ResultProcessor . MultiStream , defaultValue : Array . Empty < RedisStream > ( ) ) ;
32633263 }
32643264
3265- public StreamEntry [ ] StreamReadGroup ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue ? position , int ? count , CommandFlags flags )
3266- {
3267- return StreamReadGroup (
3265+ public StreamEntry [ ] StreamReadGroup ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue ? position , int ? count , CommandFlags flags ) =>
3266+ StreamReadGroup (
32683267 key ,
32693268 groupName ,
32703269 consumerName ,
32713270 position ,
32723271 count ,
32733272 false ,
3273+ null ,
32743274 flags ) ;
3275- }
32763275
32773276 public StreamEntry [ ] StreamReadGroup ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue ? position = null , int ? count = null , bool noAck = false , CommandFlags flags = CommandFlags . None )
3278- {
3279- var actualPosition = position ?? StreamPosition . NewMessages ;
3277+ => StreamReadGroup (
3278+ key ,
3279+ groupName ,
3280+ consumerName ,
3281+ position ,
3282+ count ,
3283+ noAck ,
3284+ null ,
3285+ flags ) ;
32803286
3287+ public StreamEntry [ ] StreamReadGroup ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue ? position = null , int ? count = null , bool noAck = false , TimeSpan ? claimMinIdleTime = null , CommandFlags flags = CommandFlags . None )
3288+ {
32813289 var msg = GetStreamReadGroupMessage (
32823290 key ,
32833291 groupName ,
32843292 consumerName ,
3285- StreamPosition . Resolve ( actualPosition , RedisCommand . XREADGROUP ) ,
3293+ StreamPosition . Resolve ( position ?? StreamPosition . NewMessages , RedisCommand . XREADGROUP ) ,
32863294 count ,
32873295 noAck ,
3296+ claimMinIdleTime ,
32883297 flags ) ;
32893298
32903299 return ExecuteSync ( msg , ResultProcessor . SingleStreamWithNameSkip , defaultValue : Array . Empty < StreamEntry > ( ) ) ;
@@ -3299,20 +3308,31 @@ public Task<StreamEntry[]> StreamReadGroupAsync(RedisKey key, RedisValue groupNa
32993308 position ,
33003309 count ,
33013310 false ,
3311+ null ,
33023312 flags ) ;
33033313 }
33043314
33053315 public Task < StreamEntry [ ] > StreamReadGroupAsync ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue ? position = null , int ? count = null , bool noAck = false , CommandFlags flags = CommandFlags . None )
3306- {
3307- var actualPosition = position ?? StreamPosition . NewMessages ;
3316+ => StreamReadGroupAsync (
3317+ key ,
3318+ groupName ,
3319+ consumerName ,
3320+ position ,
3321+ count ,
3322+ noAck ,
3323+ null ,
3324+ flags ) ;
33083325
3326+ public Task < StreamEntry [ ] > StreamReadGroupAsync ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue ? position = null , int ? count = null , bool noAck = false , TimeSpan ? claimMinIdleTime = null , CommandFlags flags = CommandFlags . None )
3327+ {
33093328 var msg = GetStreamReadGroupMessage (
33103329 key ,
33113330 groupName ,
33123331 consumerName ,
3313- StreamPosition . Resolve ( actualPosition , RedisCommand . XREADGROUP ) ,
3332+ StreamPosition . Resolve ( position ?? StreamPosition . NewMessages , RedisCommand . XREADGROUP ) ,
33143333 count ,
33153334 noAck ,
3335+ claimMinIdleTime ,
33163336 flags ) ;
33173337
33183338 return ExecuteAsync ( msg , ResultProcessor . SingleStreamWithNameSkip , defaultValue : Array . Empty < StreamEntry > ( ) ) ;
@@ -4838,8 +4858,8 @@ private Message GetStreamRangeMessage(RedisKey key, RedisValue? minId, RedisValu
48384858 values ) ;
48394859 }
48404860
4841- private Message GetStreamReadGroupMessage ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue afterId , int ? count , bool noAck , CommandFlags flags ) =>
4842- new SingleStreamReadGroupCommandMessage ( Database , flags , key , groupName , consumerName , afterId , count , noAck ) ;
4861+ private Message GetStreamReadGroupMessage ( RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue afterId , int ? count , bool noAck , TimeSpan ? claimMinIdleTime , CommandFlags flags ) =>
4862+ new SingleStreamReadGroupCommandMessage ( Database , flags , key , groupName , consumerName , afterId , count , noAck , claimMinIdleTime ) ;
48434863
48444864 private sealed class SingleStreamReadGroupCommandMessage : Message . CommandKeyBase // XREADGROUP with single stream. eg XREADGROUP GROUP mygroup Alice COUNT 1 STREAMS mystream >
48454865 {
@@ -4849,8 +4869,9 @@ private sealed class SingleStreamReadGroupCommandMessage : Message.CommandKeyBas
48494869 private readonly int ? count ;
48504870 private readonly bool noAck ;
48514871 private readonly int argCount ;
4872+ private readonly TimeSpan ? claimMinIdleTime ;
48524873
4853- public SingleStreamReadGroupCommandMessage ( int db , CommandFlags flags , RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue afterId , int ? count , bool noAck )
4874+ public SingleStreamReadGroupCommandMessage ( int db , CommandFlags flags , RedisKey key , RedisValue groupName , RedisValue consumerName , RedisValue afterId , int ? count , bool noAck , TimeSpan ? claimMinIdleTime )
48544875 : base ( db , flags , RedisCommand . XREADGROUP , key )
48554876 {
48564877 if ( count . HasValue && count <= 0 )
@@ -4867,7 +4888,8 @@ public SingleStreamReadGroupCommandMessage(int db, CommandFlags flags, RedisKey
48674888 this . afterId = afterId ;
48684889 this . count = count ;
48694890 this . noAck = noAck ;
4870- argCount = 6 + ( count . HasValue ? 2 : 0 ) + ( noAck ? 1 : 0 ) ;
4891+ this . claimMinIdleTime = claimMinIdleTime ;
4892+ argCount = 6 + ( count . HasValue ? 2 : 0 ) + ( noAck ? 1 : 0 ) + ( claimMinIdleTime . HasValue ? 2 : 0 ) ;
48714893 }
48724894
48734895 protected override void WriteImpl ( PhysicalConnection physical )
@@ -4888,6 +4910,12 @@ protected override void WriteImpl(PhysicalConnection physical)
48884910 physical . WriteBulkString ( StreamConstants . NoAck ) ;
48894911 }
48904912
4913+ if ( claimMinIdleTime . HasValue )
4914+ {
4915+ physical . WriteBulkString ( StreamConstants . Claim ) ;
4916+ physical . WriteBulkString ( claimMinIdleTime . Value . TotalMilliseconds ) ;
4917+ }
4918+
48914919 physical . WriteBulkString ( StreamConstants . Streams ) ;
48924920 physical . Write ( Key ) ;
48934921 physical . WriteBulkString ( afterId ) ;
0 commit comments