|
|
|
@ -27,7 +27,7 @@ import org.redisson.api.PendingEntry;
|
|
|
|
|
import org.redisson.api.PendingResult;
|
|
|
|
|
import org.redisson.api.RFuture;
|
|
|
|
|
import org.redisson.api.RStream;
|
|
|
|
|
import org.redisson.api.StreamId;
|
|
|
|
|
import org.redisson.api.StreamMessageId;
|
|
|
|
|
import org.redisson.client.codec.Codec;
|
|
|
|
|
import org.redisson.client.codec.StringCodec;
|
|
|
|
|
import org.redisson.client.protocol.RedisCommands;
|
|
|
|
@ -69,25 +69,25 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> createGroupAsync(String groupName) {
|
|
|
|
|
return createGroupAsync(groupName, StreamId.NEWEST);
|
|
|
|
|
return createGroupAsync(groupName, StreamMessageId.NEWEST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void createGroup(String groupName, StreamId id) {
|
|
|
|
|
public void createGroup(String groupName, StreamMessageId id) {
|
|
|
|
|
get(createGroupAsync(groupName, id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> createGroupAsync(String groupName, StreamId id) {
|
|
|
|
|
public RFuture<Void> createGroupAsync(String groupName, StreamMessageId id) {
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XGROUP, "CREATE", getName(), groupName, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Long> ackAsync(String groupName, StreamId... ids) {
|
|
|
|
|
public RFuture<Long> ackAsync(String groupName, StreamMessageId... ids) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
params.add(groupName);
|
|
|
|
|
for (StreamId id : ids) {
|
|
|
|
|
for (StreamMessageId id : ids) {
|
|
|
|
|
params.add(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -95,7 +95,7 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Long ack(String groupName, StreamId... id) {
|
|
|
|
|
public long ack(String groupName, StreamMessageId... id) {
|
|
|
|
|
return get(ackAsync(groupName, id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -110,37 +110,59 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<List<PendingEntry>> listPendingAsync(String groupName, StreamId startId, StreamId endId, int count,
|
|
|
|
|
String consumerName) {
|
|
|
|
|
public RFuture<List<PendingEntry>> listPendingAsync(String groupName, String consumerName, StreamMessageId startId, StreamMessageId endId, int count) {
|
|
|
|
|
return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.XPENDING_ENTRIES, getName(), groupName, startId, endId, count, consumerName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<List<PendingEntry>> listPendingAsync(String groupName, StreamId startId, StreamId endId, int count) {
|
|
|
|
|
public RFuture<List<PendingEntry>> listPendingAsync(String groupName, StreamMessageId startId, StreamMessageId endId, int count) {
|
|
|
|
|
return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.XPENDING_ENTRIES, getName(), groupName, startId, endId, count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<PendingEntry> listPending(String groupName, StreamId startId, StreamId endId, int count) {
|
|
|
|
|
public List<PendingEntry> listPending(String groupName, StreamMessageId startId, StreamMessageId endId, int count) {
|
|
|
|
|
return get(listPendingAsync(groupName, startId, endId, count));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<PendingEntry> listPending(String groupName, StreamId startId, StreamId endId, int count,
|
|
|
|
|
String consumerName) {
|
|
|
|
|
return get(listPendingAsync(groupName, startId, endId, count, consumerName));
|
|
|
|
|
public List<PendingEntry> listPending(String groupName, String consumerName, StreamMessageId startId, StreamMessageId endId, int count) {
|
|
|
|
|
return get(listPendingAsync(groupName, consumerName, startId, endId, count));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> claimAsync(String groupName, String consumerName, long idleTime,
|
|
|
|
|
TimeUnit idleTimeUnit, StreamId... ids) {
|
|
|
|
|
public List<StreamMessageId> fastClaim(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit,
|
|
|
|
|
StreamMessageId... ids) {
|
|
|
|
|
return get(fastClaimAsync(groupName, consumerName, idleTime, idleTimeUnit, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<List<StreamMessageId>> fastClaimAsync(String groupName, String consumerName, long idleTime,
|
|
|
|
|
TimeUnit idleTimeUnit, StreamMessageId... ids) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
params.add(groupName);
|
|
|
|
|
params.add(consumerName);
|
|
|
|
|
params.add(idleTimeUnit.toMillis(idleTime));
|
|
|
|
|
|
|
|
|
|
for (StreamId id : ids) {
|
|
|
|
|
for (StreamMessageId id : ids) {
|
|
|
|
|
params.add(id.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
params.add("JUSTID");
|
|
|
|
|
|
|
|
|
|
return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.XCLAIM_IDS, params.toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> claimAsync(String groupName, String consumerName, long idleTime,
|
|
|
|
|
TimeUnit idleTimeUnit, StreamMessageId... ids) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
params.add(groupName);
|
|
|
|
|
params.add(consumerName);
|
|
|
|
|
params.add(idleTimeUnit.toMillis(idleTime));
|
|
|
|
|
|
|
|
|
|
for (StreamMessageId id : ids) {
|
|
|
|
|
params.add(id.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -148,30 +170,30 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> claimPending(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit,
|
|
|
|
|
StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> claim(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit,
|
|
|
|
|
StreamMessageId... ids) {
|
|
|
|
|
return get(claimAsync(groupName, consumerName, idleTime, idleTimeUnit, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, StreamMessageId... ids) {
|
|
|
|
|
return readGroupAsync(groupName, consumerName, 0, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, int count, StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, int count, StreamMessageId... ids) {
|
|
|
|
|
return readGroupAsync(groupName, consumerName, count, 0, null, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, long timeout, TimeUnit unit,
|
|
|
|
|
StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, long timeout, TimeUnit unit,
|
|
|
|
|
StreamMessageId... ids) {
|
|
|
|
|
return readGroupAsync(groupName, consumerName, 0, timeout, unit, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, int count, long timeout, TimeUnit unit,
|
|
|
|
|
StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readGroupAsync(String groupName, String consumerName, int count, long timeout, TimeUnit unit,
|
|
|
|
|
StreamMessageId... ids) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
params.add("GROUP");
|
|
|
|
|
params.add(groupName);
|
|
|
|
@ -194,7 +216,7 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
params.add(">");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (StreamId id : ids) {
|
|
|
|
|
for (StreamMessageId id : ids) {
|
|
|
|
|
params.add(id.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -205,62 +227,62 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> readGroup(String groupName, String consumerName, StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> readGroup(String groupName, String consumerName, StreamMessageId... ids) {
|
|
|
|
|
return get(readGroupAsync(groupName, consumerName, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> readGroup(String groupName, String consumerName, int count, StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> readGroup(String groupName, String consumerName, int count, StreamMessageId... ids) {
|
|
|
|
|
return get(readGroupAsync(groupName, consumerName, count, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> readGroup(String groupName, String consumerName, long timeout, TimeUnit unit, StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> readGroup(String groupName, String consumerName, long timeout, TimeUnit unit, StreamMessageId... ids) {
|
|
|
|
|
return get(readGroupAsync(groupName, consumerName, timeout, unit, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> readGroup(String groupName, String consumerName, int count, long timeout, TimeUnit unit,
|
|
|
|
|
StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> readGroup(String groupName, String consumerName, int count, long timeout, TimeUnit unit,
|
|
|
|
|
StreamMessageId... ids) {
|
|
|
|
|
return get(readGroupAsync(groupName, consumerName, count, timeout, unit, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StreamId addAll(Map<K, V> entries) {
|
|
|
|
|
public StreamMessageId addAll(Map<K, V> entries) {
|
|
|
|
|
return addAll(entries, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<StreamId> addAllAsync(Map<K, V> entries) {
|
|
|
|
|
public RFuture<StreamMessageId> addAllAsync(Map<K, V> entries) {
|
|
|
|
|
return addAllAsync(entries, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addAll(StreamId id, Map<K, V> entries) {
|
|
|
|
|
public void addAll(StreamMessageId id, Map<K, V> entries) {
|
|
|
|
|
addAll(id, entries, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> addAllAsync(StreamId id, Map<K, V> entries) {
|
|
|
|
|
public RFuture<Void> addAllAsync(StreamMessageId id, Map<K, V> entries) {
|
|
|
|
|
return addAllAsync(id, entries, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StreamId addAll(Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
public StreamMessageId addAll(Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
return get(addAllAsync(entries, trimLen, trimStrict));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<StreamId> addAllAsync(Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
public RFuture<StreamMessageId> addAllAsync(Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
return addAllCustomAsync(null, entries, trimLen, trimStrict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addAll(StreamId id, Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
public void addAll(StreamMessageId id, Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
get(addAllAsync(id, entries, trimLen, trimStrict));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <R> RFuture<R> addAllCustomAsync(StreamId id, Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
private <R> RFuture<R> addAllCustomAsync(StreamMessageId id, Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>(entries.size()*2 + 1);
|
|
|
|
|
params.add(getName());
|
|
|
|
|
|
|
|
|
@ -293,7 +315,7 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> addAllAsync(StreamId id, Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
public RFuture<Void> addAllAsync(StreamMessageId id, Map<K, V> entries, int trimLen, boolean trimStrict) {
|
|
|
|
|
return addAllCustomAsync(id, entries, trimLen, trimStrict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -308,22 +330,22 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> read(int count, StreamId ... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> read(int count, StreamMessageId ... ids) {
|
|
|
|
|
return get(readAsync(count, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(int count, StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(int count, StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return readAsync(count, -1, null, id, keyToId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> read(int count, long timeout, TimeUnit unit, StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> read(int count, long timeout, TimeUnit unit, StreamMessageId... ids) {
|
|
|
|
|
return get(readAsync(count, timeout, unit, ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(int count, long timeout, TimeUnit unit, StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(int count, long timeout, TimeUnit unit, StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
params.add("COUNT");
|
|
|
|
@ -342,7 +364,7 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
params.add(id);
|
|
|
|
|
for (StreamId nextId : keyToId.values()) {
|
|
|
|
|
for (StreamMessageId nextId : keyToId.values()) {
|
|
|
|
|
params.add(nextId.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -353,21 +375,21 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<StreamId> addAsync(K key, V value) {
|
|
|
|
|
public RFuture<StreamMessageId> addAsync(K key, V value) {
|
|
|
|
|
return addAsync(key, value, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> addAsync(StreamId id, K key, V value) {
|
|
|
|
|
public RFuture<Void> addAsync(StreamMessageId id, K key, V value) {
|
|
|
|
|
return addAsync(id, key, value, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<StreamId> addAsync(K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
public RFuture<StreamMessageId> addAsync(K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
return addCustomAsync(null, key, value, trimLen, trimStrict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private <R> RFuture<R> addCustomAsync(StreamId id, K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
private <R> RFuture<R> addCustomAsync(StreamMessageId id, K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
List<Object> params = new LinkedList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
|
|
|
|
@ -398,38 +420,38 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> addAsync(StreamId id, K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
public RFuture<Void> addAsync(StreamMessageId id, K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
return addCustomAsync(id, key, value, trimLen, trimStrict);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StreamId add(K key, V value) {
|
|
|
|
|
public StreamMessageId add(K key, V value) {
|
|
|
|
|
return get(addAsync(key, value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void add(StreamId id, K key, V value) {
|
|
|
|
|
public void add(StreamMessageId id, K key, V value) {
|
|
|
|
|
get(addAsync(id, key, value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StreamId add(K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
public StreamMessageId add(K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
return get(addAsync(key, value, trimLen, trimStrict));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void add(StreamId id, K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
public void add(StreamMessageId id, K key, V value, int trimLen, boolean trimStrict) {
|
|
|
|
|
get(addAsync(id, key, value, trimLen, trimStrict));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readAsync(int count, StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readAsync(int count, StreamMessageId... ids) {
|
|
|
|
|
return readAsync(count, 0, null, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readAsync(int count, long timeout, TimeUnit unit,
|
|
|
|
|
StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readAsync(int count, long timeout, TimeUnit unit,
|
|
|
|
|
StreamMessageId... ids) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
params.add("COUNT");
|
|
|
|
@ -444,7 +466,7 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
params.add("STREAMS");
|
|
|
|
|
params.add(getName());
|
|
|
|
|
|
|
|
|
|
for (StreamId id : ids) {
|
|
|
|
|
for (StreamMessageId id : ids) {
|
|
|
|
|
params.add(id.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -455,17 +477,17 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(int count, StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(int count, StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return get(readAsync(count, id, keyToId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return get(readAsync(count, timeout, unit, id, keyToId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> rangeAsync(int count, StreamId startId, StreamId endId) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> rangeAsync(int count, StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
List<Object> params = new LinkedList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
params.add(startId);
|
|
|
|
@ -480,12 +502,12 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> range(int count, StreamId startId, StreamId endId) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> range(int count, StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
return get(rangeAsync(count, startId, endId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> rangeReversedAsync(int count, StreamId startId, StreamId endId) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> rangeReversedAsync(int count, StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
List<Object> params = new LinkedList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
params.add(startId);
|
|
|
|
@ -500,172 +522,238 @@ public class RedissonStream<K, V> extends RedissonExpirable implements RStream<K
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> rangeReversed(int count, StreamId startId, StreamId endId) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> rangeReversed(int count, StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
return get(rangeReversedAsync(count, startId, endId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readAsync(StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readAsync(StreamMessageId... ids) {
|
|
|
|
|
return readAsync(0, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> readAsync(long timeout, TimeUnit unit, StreamId... ids) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> readAsync(long timeout, TimeUnit unit, StreamMessageId... ids) {
|
|
|
|
|
return readAsync(0, timeout, unit, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return readAsync(0, id, keyToId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(long timeout, TimeUnit unit, StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(long timeout, TimeUnit unit, StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return readAsync(0, timeout, unit, id, keyToId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> rangeAsync(StreamId startId, StreamId endId) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> rangeAsync(StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
return rangeAsync(0, startId, endId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<StreamId, Map<K, V>>> rangeReversedAsync(StreamId startId, StreamId endId) {
|
|
|
|
|
public RFuture<Map<StreamMessageId, Map<K, V>>> rangeReversedAsync(StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
return rangeReversedAsync(0, startId, endId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> read(StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> read(StreamMessageId... ids) {
|
|
|
|
|
return read(0, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> read(long timeout, TimeUnit unit, StreamId... ids) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> read(long timeout, TimeUnit unit, StreamMessageId... ids) {
|
|
|
|
|
return read(0, timeout, unit, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return read(0, id, keyToId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamId id, Map<String, StreamId> keyToId) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamMessageId id, Map<String, StreamMessageId> keyToId) {
|
|
|
|
|
return read(0, timeout, unit, id, keyToId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> range(StreamId startId, StreamId endId) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> range(StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
return range(0, startId, endId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<StreamId, Map<K, V>> rangeReversed(StreamId startId, StreamId endId) {
|
|
|
|
|
public Map<StreamMessageId, Map<K, V>> rangeReversed(StreamMessageId startId, StreamMessageId endId) {
|
|
|
|
|
return rangeReversed(0, startId, endId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(StreamId id, String key2, StreamId id2) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(StreamMessageId id, String key2, StreamMessageId id2) {
|
|
|
|
|
return readAsync(id, Collections.singletonMap(key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(StreamId id, String key2, StreamId id2, String key3,
|
|
|
|
|
StreamId id3) {
|
|
|
|
|
Map<String, StreamId> params = new HashMap<String, StreamId>(2);
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(StreamMessageId id, String key2, StreamMessageId id2, String key3,
|
|
|
|
|
StreamMessageId id3) {
|
|
|
|
|
Map<String, StreamMessageId> params = new HashMap<String, StreamMessageId>(2);
|
|
|
|
|
params.put(key2, id2);
|
|
|
|
|
params.put(key3, id3);
|
|
|
|
|
return readAsync(id, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(int count, StreamId id, String key2, StreamId id2) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(int count, StreamMessageId id, String key2, StreamMessageId id2) {
|
|
|
|
|
return readAsync(count, id, Collections.singletonMap(key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(int count, StreamId id, String key2, StreamId id2,
|
|
|
|
|
String key3, StreamId id3) {
|
|
|
|
|
Map<String, StreamId> params = new HashMap<String, StreamId>(2);
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(int count, StreamMessageId id, String key2, StreamMessageId id2,
|
|
|
|
|
String key3, StreamMessageId id3) {
|
|
|
|
|
Map<String, StreamMessageId> params = new HashMap<String, StreamMessageId>(2);
|
|
|
|
|
params.put(key2, id2);
|
|
|
|
|
params.put(key3, id3);
|
|
|
|
|
return readAsync(count, id, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(long timeout, TimeUnit unit, StreamId id,
|
|
|
|
|
String key2, StreamId id2) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(long timeout, TimeUnit unit, StreamMessageId id,
|
|
|
|
|
String key2, StreamMessageId id2) {
|
|
|
|
|
return readAsync(timeout, unit, id, Collections.singletonMap(key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(long timeout, TimeUnit unit, StreamId id,
|
|
|
|
|
String key2, StreamId id2, String key3, StreamId id3) {
|
|
|
|
|
Map<String, StreamId> params = new HashMap<String, StreamId>(2);
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(long timeout, TimeUnit unit, StreamMessageId id,
|
|
|
|
|
String key2, StreamMessageId id2, String key3, StreamMessageId id3) {
|
|
|
|
|
Map<String, StreamMessageId> params = new HashMap<String, StreamMessageId>(2);
|
|
|
|
|
params.put(key2, id2);
|
|
|
|
|
params.put(key3, id3);
|
|
|
|
|
return readAsync(timeout, unit, id, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(int count, long timeout, TimeUnit unit, StreamId id,
|
|
|
|
|
String key2, StreamId id2) {
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(int count, long timeout, TimeUnit unit, StreamMessageId id,
|
|
|
|
|
String key2, StreamMessageId id2) {
|
|
|
|
|
return readAsync(count, timeout, unit, id, Collections.singletonMap(key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> readAsync(int count, long timeout, TimeUnit unit, StreamId id,
|
|
|
|
|
String key2, StreamId id2, String key3, StreamId id3) {
|
|
|
|
|
Map<String, StreamId> params = new HashMap<String, StreamId>(2);
|
|
|
|
|
public RFuture<Map<String, Map<StreamMessageId, Map<K, V>>>> readAsync(int count, long timeout, TimeUnit unit, StreamMessageId id,
|
|
|
|
|
String key2, StreamMessageId id2, String key3, StreamMessageId id3) {
|
|
|
|
|
Map<String, StreamMessageId> params = new HashMap<String, StreamMessageId>(2);
|
|
|
|
|
params.put(key2, id2);
|
|
|
|
|
params.put(key3, id3);
|
|
|
|
|
return readAsync(count, timeout, unit, id, params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(StreamId id, String key2, StreamId id2) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(StreamMessageId id, String key2, StreamMessageId id2) {
|
|
|
|
|
return get(readAsync(id, key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(StreamId id, String key2, StreamId id2, String key3,
|
|
|
|
|
StreamId id3) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(StreamMessageId id, String key2, StreamMessageId id2, String key3,
|
|
|
|
|
StreamMessageId id3) {
|
|
|
|
|
return get(readAsync(id, key2, id2, key3, id3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(int count, StreamId id, String key2, StreamId id2) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(int count, StreamMessageId id, String key2, StreamMessageId id2) {
|
|
|
|
|
return get(readAsync(count, id, key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(int count, StreamId id, String key2, StreamId id2, String key3,
|
|
|
|
|
StreamId id3) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(int count, StreamMessageId id, String key2, StreamMessageId id2, String key3,
|
|
|
|
|
StreamMessageId id3) {
|
|
|
|
|
return get(readAsync(count, id, key2, id2, key3, id3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamId id, String key2,
|
|
|
|
|
StreamId id2) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamMessageId id, String key2,
|
|
|
|
|
StreamMessageId id2) {
|
|
|
|
|
return get(readAsync(timeout, unit, id, key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamId id, String key2,
|
|
|
|
|
StreamId id2, String key3, StreamId id3) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamMessageId id, String key2,
|
|
|
|
|
StreamMessageId id2, String key3, StreamMessageId id3) {
|
|
|
|
|
return get(readAsync(timeout, unit, id, key2, id2, key3, id3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamId id, String key2,
|
|
|
|
|
StreamId id2) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamMessageId id, String key2,
|
|
|
|
|
StreamMessageId id2) {
|
|
|
|
|
return get(readAsync(count, timeout, unit, id, key2, id2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Map<StreamId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamId id, String key2,
|
|
|
|
|
StreamId id2, String key3, StreamId id3) {
|
|
|
|
|
public Map<String, Map<StreamMessageId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamMessageId id, String key2,
|
|
|
|
|
StreamMessageId id2, String key3, StreamMessageId id3) {
|
|
|
|
|
return get(readAsync(count, timeout, unit, id, key2, id2, key3, id3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Long> removeAsync(StreamMessageId... ids) {
|
|
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
|
|
params.add(getName());
|
|
|
|
|
for (StreamMessageId id : ids) {
|
|
|
|
|
params.add(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XDEL, params.toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long remove(StreamMessageId... ids) {
|
|
|
|
|
return get(removeAsync(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Long> trimAsync(int count) {
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XTRIM, "MAXLEN", count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Long> trimNonStrictAsync(int count) {
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XTRIM, "MAXLEN", "~", count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long trim(int count) {
|
|
|
|
|
return get(trimAsync(count));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long trimNonStrict(int count) {
|
|
|
|
|
return get(trimNonStrictAsync(count));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> removeGroupAsync(String groupName) {
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XGROUP, "DESTROY", getName(), groupName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void removeGroup(String groupName) {
|
|
|
|
|
get(removeGroupAsync(groupName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Long> removeConsumerAsync(String groupName, String consumerName) {
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XGROUP_LONG, "DELCONSUMER", getName(), groupName, consumerName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public long removeConsumer(String groupName, String consumerName) {
|
|
|
|
|
return get(removeConsumerAsync(groupName, consumerName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RFuture<Void> updateGroupMessageIdAsync(String groupName, StreamMessageId id) {
|
|
|
|
|
return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.XGROUP, "SETID", getName(), groupName, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateGroupMessageId(String groupName, StreamMessageId id) {
|
|
|
|
|
get(updateGroupMessageIdAsync(groupName, id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|