|
27 | 27 | import org.springframework.data.domain.Range;
|
28 | 28 | import org.springframework.data.redis.connection.Limit;
|
29 | 29 | import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
|
30 |
| -import org.springframework.data.redis.connection.stream.*; |
| 30 | +import org.springframework.data.redis.connection.stream.ByteBufferRecord; |
| 31 | +import org.springframework.data.redis.connection.stream.Consumer; |
| 32 | +import org.springframework.data.redis.connection.stream.MapRecord; |
| 33 | +import org.springframework.data.redis.connection.stream.ObjectRecord; |
| 34 | +import org.springframework.data.redis.connection.stream.PendingMessage; |
| 35 | +import org.springframework.data.redis.connection.stream.PendingMessages; |
| 36 | +import org.springframework.data.redis.connection.stream.PendingMessagesSummary; |
| 37 | +import org.springframework.data.redis.connection.stream.ReadOffset; |
31 | 38 | import org.springframework.data.redis.connection.stream.Record;
|
| 39 | +import org.springframework.data.redis.connection.stream.RecordId; |
32 | 40 | import org.springframework.data.redis.connection.stream.StreamInfo.XInfoConsumer;
|
33 | 41 | import org.springframework.data.redis.connection.stream.StreamInfo.XInfoGroup;
|
34 | 42 | import org.springframework.data.redis.connection.stream.StreamInfo.XInfoStream;
|
| 43 | +import org.springframework.data.redis.connection.stream.StreamOffset; |
| 44 | +import org.springframework.data.redis.connection.stream.StreamReadOptions; |
| 45 | +import org.springframework.data.redis.connection.stream.StreamRecords; |
35 | 46 | import org.springframework.data.redis.hash.HashMapper;
|
36 | 47 | import org.springframework.lang.Nullable;
|
37 | 48 | import org.springframework.util.Assert;
|
|
42 | 53 | * @author Mark Paluch
|
43 | 54 | * @author Christoph Strobl
|
44 | 55 | * @author Dengliming
|
| 56 | + * @author Marcin Zielinski |
| 57 | + * @author John Blum |
45 | 58 | * @since 2.2
|
46 | 59 | */
|
47 | 60 | public interface ReactiveStreamOperations<K, HK, HV> extends HashMapperProvider<HK, HV> {
|
@@ -129,33 +142,48 @@ default Mono<RecordId> add(MapRecord<K, ? extends HK, ? extends HV> record) {
|
129 | 142 | Mono<RecordId> add(Record<K, ?> record);
|
130 | 143 |
|
131 | 144 | /**
|
132 |
| - * Changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument. |
133 |
| - * The message is claimed only if its idle time is greater the minimum idle time specified when calling XCLAIM |
| 145 | + * Changes the ownership of a pending message so that the new owner is the consumer specified as |
| 146 | + * the command argument. |
134 | 147 | *
|
135 |
| - * @param key the stream key. |
136 |
| - * @param group name of the consumer group. |
137 |
| - * @param newOwner name of the consumer claiming the message. |
138 |
| - * @param minIdleTime idle time required for a message to be claimed. |
139 |
| - * @param recordIds record IDs to be claimed |
| 148 | + * The message is claimed only if its idle time (ms) is greater than the {@link Duration minimum idle time} |
| 149 | + * specified when calling {@literal XCLAIM}. |
140 | 150 | *
|
141 |
| - * @return the {@link Flux} of claimed MapRecords. |
| 151 | + * @param key {@link K key} to the steam. |
| 152 | + * @param consumerGroup {@link String name} of the consumer group. |
| 153 | + * @param newOwner {@link String name} of the consumer claiming the message. |
| 154 | + * @param minIdleTime {@link Duration minimum idle time} required for a message to be claimed. |
| 155 | + * @param recordIds {@link RecordId record IDs} to be claimed. |
| 156 | + * @return {@link Flux} of claimed {@link MapRecord MapRecords}. |
142 | 157 | * @see <a href="https://redis.io/commands/xclaim/">Redis Documentation: XCLAIM</a>
|
| 158 | + * @see org.springframework.data.redis.connection.stream.MapRecord |
| 159 | + * @see org.springframework.data.redis.connection.stream.RecordId |
| 160 | + * @see #claim(Object, String, String, XClaimOptions) |
| 161 | + * @see reactor.core.publisher.Flux |
143 | 162 | */
|
144 |
| - Flux<MapRecord<K, HK, HV>> claim(K key, String group, String newOwner, Duration minIdleTime, RecordId... recordIds); |
| 163 | + default Flux<MapRecord<K, HK, HV>> claim(K key, String consumerGroup, String newOwner, Duration minIdleTime, |
| 164 | + RecordId... recordIds) { |
| 165 | + |
| 166 | + return claim(key, consumerGroup, newOwner, XClaimOptions.minIdle(minIdleTime).ids(recordIds)); |
| 167 | + } |
145 | 168 |
|
146 | 169 | /**
|
147 |
| - * Changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument. |
148 |
| - * The message is claimed only if its idle time is greater the minimum idle time specified when calling XCLAIM |
149 |
| - * |
150 |
| - * @param key the stream key. |
151 |
| - * @param group name of the consumer group. |
152 |
| - * @param newOwner name of the consumer claiming the message. |
153 |
| - * @param xClaimOptions additional parameters for the CLAIM call. |
| 170 | + * Changes the ownership of a pending message so that the new owner is the consumer specified as |
| 171 | + * the command argument. |
| 172 | +
|
| 173 | + * The message is claimed only if its idle time (ms) is greater than the given {@link Duration minimum idle time} |
| 174 | + * specified when calling {@literal XCLAIM}. |
154 | 175 | *
|
155 |
| - * @return the {@link Flux} of claimed MapRecords. |
| 176 | + * @param key {@link K key} to the steam. |
| 177 | + * @param consumerGroup {@link String name} of the consumer group. |
| 178 | + * @param newOwner {@link String name} of the consumer claiming the message. |
| 179 | + * @param xClaimOptions additional parameters for the {@literal CLAIM} call. |
| 180 | + * @return a {@link Flux} of claimed {@link MapRecord MapRecords}. |
156 | 181 | * @see <a href="https://redis.io/commands/xclaim/">Redis Documentation: XCLAIM</a>
|
| 182 | + * @see org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions |
| 183 | + * @see org.springframework.data.redis.connection.stream.MapRecord |
| 184 | + * @see reactor.core.publisher.Flux |
157 | 185 | */
|
158 |
| - Flux<MapRecord<K, HK, HV>> claim(K key, String group, String newOwner, XClaimOptions xClaimOptions); |
| 186 | + Flux<MapRecord<K, HK, HV>> claim(K key, String consumerGroup, String newOwner, XClaimOptions xClaimOptions); |
159 | 187 |
|
160 | 188 | /**
|
161 | 189 | * Removes the specified records from the stream. Returns the number of records deleted, that may be different from
|
|
0 commit comments