3333import redis .clients .jedis .params .GetExParams ;
3434import redis .clients .jedis .params .MigrateParams ;
3535import redis .clients .jedis .params .SetParams ;
36+ import redis .clients .jedis .params .XClaimParams ;
3637import redis .clients .jedis .params .ZAddParams ;
3738import redis .clients .jedis .params .ZIncrByParams ;
3839import redis .clients .jedis .params .LPosParams ;
@@ -1706,7 +1707,7 @@ public void xpendingSummary(final byte[] key, final byte[] groupname) {
17061707 public void xclaim (byte [] key , byte [] groupname , byte [] consumername , long minIdleTime ,
17071708 long newIdleTime , int retries , boolean force , byte [][] ids ) {
17081709
1709- ArrayList <byte []> arguments = new ArrayList <>(10 + ids .length );
1710+ List <byte []> arguments = new ArrayList <>(10 + ids .length );
17101711
17111712 arguments .add (key );
17121713 arguments .add (groupname );
@@ -1729,6 +1730,37 @@ public void xclaim(byte[] key, byte[] groupname, byte[] consumername, long minId
17291730 sendCommand (XCLAIM , arguments .toArray (new byte [arguments .size ()][]));
17301731 }
17311732
1733+ private void xclaim (byte [] key , byte [] groupname , byte [] consumername , long minIdleTime ,
1734+ XClaimParams params , byte [][] ids , boolean justId ) {
1735+ final byte [][] bparams = params .getByteParams ();
1736+ final int paramLength = bparams .length ;
1737+ final int idsLength = ids .length ;
1738+ final byte [][] args = new byte [4 + paramLength + idsLength + (justId ? 1 : 0 )][];
1739+ int index = 0 ;
1740+ args [index ++] = key ;
1741+ args [index ++] = groupname ;
1742+ args [index ++] = consumername ;
1743+ args [index ++] = toByteArray (minIdleTime );
1744+ System .arraycopy (ids , 0 , args , index , idsLength );
1745+ index += idsLength ;
1746+ System .arraycopy (bparams , 0 , args , index , paramLength );
1747+ index += paramLength ;
1748+ if (justId ) {
1749+ args [index ++] = Keyword .JUSTID .getRaw ();
1750+ }
1751+ sendCommand (XCLAIM , args );
1752+ }
1753+
1754+ public void xclaim (byte [] key , byte [] groupname , byte [] consumername , long minIdleTime ,
1755+ XClaimParams params , byte []... ids ) {
1756+ xclaim (key , groupname , consumername , minIdleTime , params , ids , false );
1757+ }
1758+
1759+ public void xclaimJustId (byte [] key , byte [] groupname , byte [] consumername , long minIdleTime ,
1760+ XClaimParams params , byte []... ids ) {
1761+ xclaim (key , groupname , consumername , minIdleTime , params , ids , true );
1762+ }
1763+
17321764 public void xinfoStream (byte [] key ) {
17331765 sendCommand (XINFO , Keyword .STREAM .getRaw (), key );
17341766 }
0 commit comments