|
15 | 15 | */
|
16 | 16 | package org.springframework.data.redis.connection.jedis;
|
17 | 17 |
|
| 18 | +import org.springframework.data.redis.connection.stream.ClaimedMessages; |
| 19 | +import org.springframework.data.redis.connection.stream.ClaimedMessagesIds; |
18 | 20 | import redis.clients.jedis.BuilderFactory;
|
19 | 21 | import redis.clients.jedis.Jedis;
|
20 | 22 | import redis.clients.jedis.commands.PipelineBinaryCommands;
|
21 | 23 | import redis.clients.jedis.commands.StreamPipelineBinaryCommands;
|
22 | 24 | import redis.clients.jedis.params.XAddParams;
|
| 25 | +import redis.clients.jedis.params.XAutoClaimParams; |
23 | 26 | import redis.clients.jedis.params.XClaimParams;
|
24 | 27 | import redis.clients.jedis.params.XPendingParams;
|
25 | 28 | import redis.clients.jedis.params.XReadGroupParams;
|
26 | 29 | import redis.clients.jedis.params.XReadParams;
|
27 | 30 | import redis.clients.jedis.resps.StreamConsumersInfo;
|
28 | 31 | import redis.clients.jedis.resps.StreamGroupInfo;
|
29 | 32 |
|
| 33 | +import java.time.Duration; |
30 | 34 | import java.util.ArrayList;
|
31 | 35 | import java.util.Arrays;
|
32 | 36 | import java.util.Collections;
|
@@ -116,6 +120,74 @@ public List<ByteRecord> xClaim(byte[] key, String group, String newOwner, XClaim
|
116 | 120 | .get(r -> StreamConverters.convertToByteRecord(key, r));
|
117 | 121 | }
|
118 | 122 |
|
| 123 | + @Override |
| 124 | + public ClaimedMessagesIds xAutoclaimJustId(byte[] key, String group, String newOwner, Duration minIdleTime, String start) { |
| 125 | + |
| 126 | + Assert.notNull(key, "Key must not be null"); |
| 127 | + Assert.notNull(group, "Group must not be null"); |
| 128 | + Assert.notNull(minIdleTime, "MinIdleTime must not be null"); |
| 129 | + Assert.notNull(start, "Start must not be null"); |
| 130 | + |
| 131 | + XAutoClaimParams params = XAutoClaimParams.xAutoClaimParams(); |
| 132 | + |
| 133 | + final List<ByteRecord> byteRecords = connection.invoke() |
| 134 | + .from(Jedis::xautoclaimJustId, ResponseCommands::xautoclaimJustId, key, JedisConverters.toBytes(group), |
| 135 | + JedisConverters.toBytes(newOwner), minIdleTime.toMillis(), JedisConverters.toBytes(start), |
| 136 | + params).get(r -> StreamConverters.convertToByteRecord(key, r)); |
| 137 | + |
| 138 | + return null; |
| 139 | + } |
| 140 | + |
| 141 | + @Override |
| 142 | + public ClaimedMessagesIds xAutoclaimJustId(byte[] key, String group, String newOwner, Duration minIdleTime, String start, Long count) { |
| 143 | + Assert.notNull(key, "Key must not be null"); |
| 144 | + Assert.notNull(group, "Group must not be null"); |
| 145 | + Assert.notNull(minIdleTime, "MinIdleTime must not be null"); |
| 146 | + Assert.notNull(start, "Start must not be null"); |
| 147 | + Assert.notNull(count, "Count must not be null"); |
| 148 | + |
| 149 | + XAutoClaimParams params = XAutoClaimParams.xAutoClaimParams().count(count.intValue()); |
| 150 | + |
| 151 | + final List<ByteRecord> byteRecords = connection.invoke() |
| 152 | + .from(Jedis::xautoclaimJustId, ResponseCommands::xautoclaimJustId, key, JedisConverters.toBytes(group), |
| 153 | + JedisConverters.toBytes(newOwner), minIdleTime.toMillis(), JedisConverters.toBytes(start), |
| 154 | + params).get(r -> StreamConverters.convertToByteRecord(key, r)); |
| 155 | + |
| 156 | + return null; |
| 157 | + } |
| 158 | + |
| 159 | + @Override |
| 160 | + public ClaimedMessages xAutoclaim(byte[] key, String group, String newOwner, Duration minIdleTime, String start) { |
| 161 | + Assert.notNull(key, "Key must not be null"); |
| 162 | + Assert.notNull(group, "Group must not be null"); |
| 163 | + Assert.notNull(newOwner, "NewOwner must not be null"); |
| 164 | + |
| 165 | + XAutoClaimParams params = XAutoClaimParams.xAutoClaimParams(); |
| 166 | + |
| 167 | + final List<ByteRecord> br= connection.invoke() |
| 168 | + .from(Jedis::xautoclaim, ResponseCommands::xautoclaim, key, JedisConverters.toBytes(group), |
| 169 | + JedisConverters.toBytes(newOwner), minIdleTime.toMillis(), JedisConverters.toBytes(start), |
| 170 | + params).get(r -> StreamConverters.convertToByteRecord(key, r)); |
| 171 | + |
| 172 | + return null; |
| 173 | + } |
| 174 | + |
| 175 | + @Override |
| 176 | + public ClaimedMessages xAutoclaim(byte[] key, String group, String newOwner, Duration minIdleTime, String start, Long count) { |
| 177 | + Assert.notNull(key, "Key must not be null"); |
| 178 | + Assert.notNull(group, "Group must not be null"); |
| 179 | + Assert.notNull(newOwner, "NewOwner must not be null"); |
| 180 | + |
| 181 | + XAutoClaimParams params = XAutoClaimParams.xAutoClaimParams().count(count.intValue()); |
| 182 | + |
| 183 | + final List<ByteRecord> br= connection.invoke() |
| 184 | + .from(Jedis::xautoclaim, ResponseCommands::xautoclaim, key, JedisConverters.toBytes(group), |
| 185 | + JedisConverters.toBytes(newOwner), minIdleTime.toMillis(), JedisConverters.toBytes(start), |
| 186 | + params).get(r -> StreamConverters.convertToByteRecord(key, r)); |
| 187 | + |
| 188 | + return null; |
| 189 | + } |
| 190 | + |
119 | 191 | @Override
|
120 | 192 | public Long xDel(byte[] key, RecordId... recordIds) {
|
121 | 193 |
|
|
0 commit comments