Redis Streams XGROUP, XPENDING, XACK, XCLAIM commands support added. #1490
parent
f574b60315
commit
7c532057f9
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
/**
|
||||
* Entry object for pending messages request.
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
*/
|
||||
public class PendingEntry {
|
||||
|
||||
private StreamId id;
|
||||
private String consumerName;
|
||||
private long idleTime;
|
||||
private long lastTimeDelivered;
|
||||
|
||||
public PendingEntry(StreamId id, String consumerName, long idleTime, long lastTimeDelivered) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.consumerName = consumerName;
|
||||
this.idleTime = idleTime;
|
||||
this.lastTimeDelivered = lastTimeDelivered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns stream id of message
|
||||
*
|
||||
* @return id
|
||||
*/
|
||||
public StreamId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns name of consumer
|
||||
*
|
||||
* @return id
|
||||
*/
|
||||
public String getConsumerName() {
|
||||
return consumerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns milliseconds amount have passed since the last time
|
||||
* the message was delivered to some consumer
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public long getIdleTime() {
|
||||
return idleTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of times that a given message was delivered
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public long getLastTimeDelivered() {
|
||||
return lastTimeDelivered;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Result object for pending messages request.
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
*/
|
||||
public class PendingResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5525031552305408248L;
|
||||
|
||||
private long total;
|
||||
private StreamId lowestId;
|
||||
private StreamId highestId;
|
||||
private Map<String, Long> consumerNames;
|
||||
|
||||
public PendingResult() {
|
||||
}
|
||||
|
||||
public PendingResult(long total, StreamId lowestId, StreamId highestId, Map<String, Long> consumerNames) {
|
||||
super();
|
||||
this.total = total;
|
||||
this.lowestId = lowestId;
|
||||
this.highestId = highestId;
|
||||
this.consumerNames = consumerNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total amount of pending messages
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lowest stream id of pending messages
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public StreamId getLowestId() {
|
||||
return lowestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Highest stream id of pending messages
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public StreamId getHighestId() {
|
||||
return highestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pending messages amount mapped by consumer name
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
public Map<String, Long> getConsumerNames() {
|
||||
return consumerNames;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,478 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
/**
|
||||
* Reactive interface for Redis Stream object.
|
||||
* <p>
|
||||
* Requires <b>Redis 5.0.0 and higher.</b>
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> key type
|
||||
* @param <V> value type
|
||||
*/
|
||||
public interface RStreamReactive<K, V> extends RExpirableReactive {
|
||||
|
||||
/**
|
||||
* Creates consumer group by name.
|
||||
*
|
||||
* @param groupName - name of group
|
||||
* @return void
|
||||
*/
|
||||
Publisher<Void> createGroup(String groupName);
|
||||
|
||||
/**
|
||||
* Creates consumer group by name and stream id.
|
||||
* Only new messages after defined stream <code>id</code> will be available for consumers of this group.
|
||||
* <p>
|
||||
* {@link StreamId#NEWEST} is used for messages arrived since the moment of group creating
|
||||
*
|
||||
* @param groupName - name of group
|
||||
* @return void
|
||||
*/
|
||||
Publisher<Void> createGroup(String groupName, StreamId id);
|
||||
|
||||
/**
|
||||
* Marks pending messages by group name and stream <code>ids</code> as correctly processed.
|
||||
*
|
||||
* @param groupName - name of group
|
||||
* @param ids - stream ids
|
||||
* @return marked messages amount
|
||||
*/
|
||||
Publisher<Long> ack(String groupName, StreamId... ids);
|
||||
|
||||
/**
|
||||
* Returns pending messages by group name
|
||||
*
|
||||
* @param groupName - name of group
|
||||
* @return result object
|
||||
*/
|
||||
Publisher<PendingResult> listPending(String groupName);
|
||||
|
||||
/**
|
||||
* Returns list of pending messages by group name.
|
||||
* Limited by start stream id and end stream id and count.
|
||||
* <p>
|
||||
* {@link StreamId#MAX} is used as max stream id
|
||||
* {@link StreamId#MIN} is used as min stream id
|
||||
*
|
||||
* @param groupName - name of group
|
||||
* @param startId - start stream id
|
||||
* @param endId - end stream id
|
||||
* @param count - amount of messages
|
||||
* @return list
|
||||
*/
|
||||
Publisher<List<PendingEntry>> listPending(String groupName, StreamId startId, StreamId endId, int count);
|
||||
|
||||
/**
|
||||
* Returns list of pending messages by group name and consumer name.
|
||||
* Limited by start stream id and end stream id and count.
|
||||
* <p>
|
||||
* {@link StreamId#MAX} is used as max stream id
|
||||
* {@link StreamId#MIN} is used as min stream id
|
||||
*
|
||||
* @param consumerName - name of consumer
|
||||
* @param groupName - name of group
|
||||
* @param startId - start stream id
|
||||
* @param endId - end stream id
|
||||
* @param count - amount of messages
|
||||
* @return list
|
||||
*/
|
||||
Publisher<List<PendingEntry>> listPending(String groupName, StreamId startId, StreamId endId, int count, String consumerName);
|
||||
|
||||
/**
|
||||
* Transfers ownership of pending messages by id to a new consumer
|
||||
* by name if idle time of messages is greater than defined value.
|
||||
*
|
||||
* @param groupName - name of group
|
||||
* @param consumerName - name of consumer
|
||||
* @param idleTime - minimum idle time of messages
|
||||
* @param idleTimeUnit - idle time unit
|
||||
* @param ids - stream ids
|
||||
* @return
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> claim(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data from <code>groupName</code> by <code>consumerName</code> and specified collection of Stream IDs.
|
||||
*
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> readGroup(String groupName, String consumerName, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data from <code>groupName</code> by <code>consumerName</code> and specified collection of Stream IDs.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> readGroup(String groupName, String consumerName, int count, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data from <code>groupName</code> by <code>consumerName</code> and specified collection of Stream IDs.
|
||||
* Wait for stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> readGroup(String groupName, String consumerName, long timeout, TimeUnit unit, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data from <code>groupName</code> by <code>consumerName</code> and specified collection of Stream IDs.
|
||||
* Wait for stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> readGroup(String groupName, String consumerName, int count, long timeout, TimeUnit unit, StreamId ... ids);
|
||||
|
||||
|
||||
/**
|
||||
* Returns number of entries in stream
|
||||
*
|
||||
* @return size of stream
|
||||
*/
|
||||
Publisher<Long> size();
|
||||
|
||||
/**
|
||||
* Appends a new entry and returns generated Stream ID
|
||||
*
|
||||
* @param key - key of entry
|
||||
* @param value - value of entry
|
||||
* @return Stream ID
|
||||
*/
|
||||
Publisher<StreamId> add(K key, V value);
|
||||
|
||||
/**
|
||||
* Appends a new entry by specified Stream ID
|
||||
*
|
||||
* @param id - Stream ID
|
||||
* @param key - key of entry
|
||||
* @param value - value of entry
|
||||
* @return void
|
||||
*/
|
||||
Publisher<Void> add(StreamId id, K key, V value);
|
||||
|
||||
/**
|
||||
* Appends a new entry and returns generated Stream ID.
|
||||
* Trims stream to a specified <code>trimLen</code> size.
|
||||
* If <code>trimStrict</code> is <code>false</code> then trims to few tens of entries more than specified length to trim.
|
||||
*
|
||||
* @param key - key of entry
|
||||
* @param value - value of entry
|
||||
* @param trimLen - length to trim
|
||||
* @param trimStrict - if <code>false</code> then trims to few tens of entries more than specified length to trim
|
||||
* @return Stream ID
|
||||
*/
|
||||
Publisher<StreamId> add(K key, V value, int trimLen, boolean trimStrict);
|
||||
|
||||
/**
|
||||
* Appends a new entry by specified Stream ID.
|
||||
* Trims stream to a specified <code>trimLen</code> size.
|
||||
* If <code>trimStrict</code> is <code>false</code> then trims to few tens of entries more than specified length to trim.
|
||||
*
|
||||
* @param id - Stream ID
|
||||
* @param key - key of entry
|
||||
* @param value - value of entry
|
||||
* @param trimLen - length to trim
|
||||
* @param trimStrict - if <code>false</code> then trims to few tens of entries more than specified length to trim
|
||||
* @return void
|
||||
*/
|
||||
Publisher<Void> add(StreamId id, K key, V value, int trimLen, boolean trimStrict);
|
||||
|
||||
/**
|
||||
* Appends new entries and returns generated Stream ID
|
||||
*
|
||||
* @param entries - entries to add
|
||||
* @return Stream ID
|
||||
*/
|
||||
Publisher<StreamId> addAll(Map<K, V> entries);
|
||||
|
||||
/**
|
||||
* Appends new entries by specified Stream ID
|
||||
*
|
||||
* @param id - Stream ID
|
||||
* @param entries - entries to add
|
||||
* @return void
|
||||
*/
|
||||
Publisher<Void> addAll(StreamId id, Map<K, V> entries);
|
||||
|
||||
/**
|
||||
* Appends new entries and returns generated Stream ID.
|
||||
* Trims stream to a specified <code>trimLen</code> size.
|
||||
* If <code>trimStrict</code> is <code>false</code> then trims to few tens of entries more than specified length to trim.
|
||||
*
|
||||
* @param entries - entries to add
|
||||
* @param trimLen - length to trim
|
||||
* @param trimStrict - if <code>false</code> then trims to few tens of entries more than specified length to trim
|
||||
* @return Stream ID
|
||||
*/
|
||||
Publisher<StreamId> addAll(Map<K, V> entries, int trimLen, boolean trimStrict);
|
||||
|
||||
/**
|
||||
* Appends new entries by specified Stream ID.
|
||||
* Trims stream to a specified <code>trimLen</code> size.
|
||||
* If <code>trimStrict</code> is <code>false</code> then trims to few tens of entries more than specified length to trim.
|
||||
*
|
||||
* @param id - Stream ID
|
||||
* @param entries - entries to add
|
||||
* @param trimLen - length to trim
|
||||
* @param trimStrict - if <code>false</code> then trims to few tens of entries more than specified length to trim
|
||||
* @return void
|
||||
*/
|
||||
Publisher<Void> addAll(StreamId id, Map<K, V> entries, int trimLen, boolean trimStrict);
|
||||
|
||||
/**
|
||||
* Read stream data by specified collection of Stream IDs.
|
||||
*
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> read(StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data by specified collection of Stream IDs.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> read(int count, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data by specified collection of Stream IDs.
|
||||
* Wait for stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> read(long timeout, TimeUnit unit, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data by specified collection of Stream IDs.
|
||||
* Wait for stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param ids - collection of Stream IDs
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> read(int count, long timeout, TimeUnit unit, StreamId ... ids);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream name including this stream.
|
||||
*
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(StreamId id, String name2, StreamId id2);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream names including this stream.
|
||||
*
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @param name3 - name of third stream
|
||||
* @param id3 - id of third stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(StreamId id, String name2, StreamId id2, String name3, StreamId id3);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream id mapped by name including this stream.
|
||||
*
|
||||
* @param id - id of this stream
|
||||
* @param nameToId - stream id mapped by name
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(StreamId id, Map<String, StreamId> nameToId);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream name including this stream.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(int count, StreamId id, String name2, StreamId id2);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream names including this stream.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @param name3 - name of third stream
|
||||
* @param id3 - id of third stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(int count, StreamId id, String name2, StreamId id2, String name3, StreamId id3);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream id mapped by name including this stream.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param id - id of this stream
|
||||
* @param nameToId - stream id mapped by name
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(int count, StreamId id, Map<String, StreamId> nameToId);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream name including this stream.
|
||||
* Wait for the first stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(long timeout, TimeUnit unit, StreamId id, String name2, StreamId id2);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream names including this stream.
|
||||
* Wait for the first stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @param name3 - name of third stream
|
||||
* @param id3 - id of third stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(long timeout, TimeUnit unit, StreamId id, String name2, StreamId id2, String name3, StreamId id3);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream id mapped by name including this stream.
|
||||
* Wait for the first stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param id - id of this stream
|
||||
* @param nameToId - stream id mapped by name
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(long timeout, TimeUnit unit, StreamId id, Map<String, StreamId> nameToId);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream name including this stream.
|
||||
* Wait for the first stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(int count, long timeout, TimeUnit unit, StreamId id, String name2, StreamId id2);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream names including this stream.
|
||||
* Wait for the first stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param id - id of this stream
|
||||
* @param name2 - name of second stream
|
||||
* @param id2 - id of second stream
|
||||
* @param name3 - name of third stream
|
||||
* @param id3 - id of third stream
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(int count, long timeout, TimeUnit unit, StreamId id, String name2, StreamId id2, String name3, StreamId id3);
|
||||
|
||||
/**
|
||||
* Read stream data by specified stream id mapped by name including this stream.
|
||||
* Wait for the first stream data availability for specified <code>timeout</code> interval.
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param timeout - time interval to wait for stream data availability
|
||||
* @param unit - time interval unit
|
||||
* @param id - id of this stream
|
||||
* @param nameToId - stream id mapped by name
|
||||
* @return stream data mapped by key and Stream ID
|
||||
*/
|
||||
Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(int count, long timeout, TimeUnit unit, StreamId id, Map<String, StreamId> nameToId);
|
||||
|
||||
/**
|
||||
* Read stream data in range by specified start Stream ID (included) and end Stream ID (included).
|
||||
*
|
||||
* @param startId - start Stream ID
|
||||
* @param endId - end Stream ID
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> range(StreamId startId, StreamId endId);
|
||||
|
||||
/**
|
||||
* Read stream data in range by specified start Stream ID (included) and end Stream ID (included).
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param startId - start Stream ID
|
||||
* @param endId - end Stream ID
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> range(int count, StreamId startId, StreamId endId);
|
||||
|
||||
/**
|
||||
* Read stream data in reverse order in range by specified start Stream ID (included) and end Stream ID (included).
|
||||
*
|
||||
* @param startId - start Stream ID
|
||||
* @param endId - end Stream ID
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> rangeReversed(StreamId startId, StreamId endId);
|
||||
|
||||
/**
|
||||
* Read stream data in reverse order in range by specified start Stream ID (included) and end Stream ID (included).
|
||||
*
|
||||
* @param count - stream data size limit
|
||||
* @param startId - start Stream ID
|
||||
* @param endId - end Stream ID
|
||||
* @return stream data mapped by Stream ID
|
||||
*/
|
||||
Publisher<Map<StreamId, Map<K, V>>> rangeReversed(int count, StreamId startId, StreamId endId);
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.client.protocol.decoder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.redisson.api.PendingEntry;
|
||||
import org.redisson.client.handler.State;
|
||||
import org.redisson.client.protocol.Decoder;
|
||||
import org.redisson.client.protocol.convertor.StreamIdConvertor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
*/
|
||||
public class PendingEntryDecoder implements MultiDecoder<Object> {
|
||||
|
||||
private final StreamIdConvertor convertor = new StreamIdConvertor();
|
||||
|
||||
@Override
|
||||
public Decoder<Object> getDecoder(int paramNum, State state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(List<Object> parts, State state) {
|
||||
if (parts.isEmpty() || parts.get(0) instanceof PendingEntry) {
|
||||
return parts;
|
||||
}
|
||||
return new PendingEntry(convertor.convert(parts.get(0)), parts.get(1).toString(),
|
||||
Long.valueOf(parts.get(2).toString()), Long.valueOf(parts.get(3).toString()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.client.protocol.decoder;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.redisson.api.PendingResult;
|
||||
import org.redisson.client.handler.State;
|
||||
import org.redisson.client.protocol.Decoder;
|
||||
import org.redisson.client.protocol.convertor.StreamIdConvertor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
*/
|
||||
public class PendingResultDecoder implements MultiDecoder<Object> {
|
||||
|
||||
private final StreamIdConvertor convertor = new StreamIdConvertor();
|
||||
|
||||
@Override
|
||||
public Decoder<Object> getDecoder(int paramNum, State state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(List<Object> parts, State state) {
|
||||
Map<String, Long> consumerNames = new LinkedHashMap<String, Long>();
|
||||
List<List<String>> customerParts = (List<List<String>>) parts.get(3);
|
||||
for (List<String> mapping : customerParts) {
|
||||
consumerNames.put(mapping.get(0), Long.valueOf(mapping.get(1)));
|
||||
}
|
||||
return new PendingResult((long)parts.get(0), convertor.convert(parts.get(1)), convertor.convert(parts.get(2)), consumerNames);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,471 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.reactive;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.redisson.RedissonStream;
|
||||
import org.redisson.api.PendingEntry;
|
||||
import org.redisson.api.PendingResult;
|
||||
import org.redisson.api.RFuture;
|
||||
import org.redisson.api.RStream;
|
||||
import org.redisson.api.RStreamAsync;
|
||||
import org.redisson.api.RStreamReactive;
|
||||
import org.redisson.api.StreamId;
|
||||
import org.redisson.client.codec.Codec;
|
||||
import org.redisson.command.CommandReactiveExecutor;
|
||||
|
||||
import reactor.fn.Supplier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <K> type of key
|
||||
* @param <V> type of value
|
||||
*/
|
||||
public class RedissonStreamReactive<K, V> extends RedissonExpirableReactive implements RStreamReactive<K, V> {
|
||||
|
||||
RStreamAsync<K, V> instance;
|
||||
|
||||
public RedissonStreamReactive(CommandReactiveExecutor commandExecutor, String name) {
|
||||
super(commandExecutor, name, new RedissonStream<K, V>(commandExecutor, name));
|
||||
this.instance = (RStream<K, V>) super.instance;
|
||||
}
|
||||
|
||||
public RedissonStreamReactive(Codec codec, CommandReactiveExecutor commandExecutor, String name) {
|
||||
super(codec, commandExecutor, name, new RedissonStream<K, V>(codec, commandExecutor, name));
|
||||
this.instance = (RStream<K, V>) super.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Void> createGroup(final String groupName) {
|
||||
return reactive(new Supplier<RFuture<Void>>() {
|
||||
@Override
|
||||
public RFuture<Void> get() {
|
||||
return instance.createGroupAsync(groupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Void> createGroup(final String groupName, final StreamId id) {
|
||||
return reactive(new Supplier<RFuture<Void>>() {
|
||||
@Override
|
||||
public RFuture<Void> get() {
|
||||
return instance.createGroupAsync(groupName, id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> ack(final String groupName, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.ackAsync(groupName, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<PendingResult> listPending(final String groupName) {
|
||||
return reactive(new Supplier<RFuture<PendingResult>>() {
|
||||
@Override
|
||||
public RFuture<PendingResult> get() {
|
||||
return instance.listPendingAsync(groupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<PendingEntry>> listPending(final String groupName, final StreamId startId, final StreamId endId, final int count) {
|
||||
return reactive(new Supplier<RFuture<List<PendingEntry>>>() {
|
||||
@Override
|
||||
public RFuture<List<PendingEntry>> get() {
|
||||
return instance.listPendingAsync(groupName, startId, endId, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<PendingEntry>> listPending(final String groupName, final StreamId startId, final StreamId endId, final int count,
|
||||
final String consumerName) {
|
||||
return reactive(new Supplier<RFuture<List<PendingEntry>>>() {
|
||||
@Override
|
||||
public RFuture<List<PendingEntry>> get() {
|
||||
return instance.listPendingAsync(groupName, startId, endId, count, consumerName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> claim(final String groupName, final String consumerName, final long idleTime,
|
||||
final TimeUnit idleTimeUnit, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.claimAsync(groupName, consumerName, idleTime, idleTimeUnit, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> readGroup(final String groupName, final String consumerName, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readGroupAsync(groupName, consumerName, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> readGroup(final String groupName, final String consumerName, final int count,
|
||||
final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readGroupAsync(groupName, consumerName, count, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> readGroup(final String groupName, final String consumerName, final long timeout,
|
||||
final TimeUnit unit, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readGroupAsync(groupName, consumerName, timeout, unit, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> readGroup(final String groupName, final String consumerName, final int count, final long timeout,
|
||||
final TimeUnit unit, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readGroupAsync(groupName, consumerName, timeout, unit, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> size() {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.sizeAsync();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<StreamId> add(final K key, final V value) {
|
||||
return reactive(new Supplier<RFuture<StreamId>>() {
|
||||
@Override
|
||||
public RFuture<StreamId> get() {
|
||||
return instance.addAsync(key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Void> add(final StreamId id, final K key, final V value) {
|
||||
return reactive(new Supplier<RFuture<Void>>() {
|
||||
@Override
|
||||
public RFuture<Void> get() {
|
||||
return instance.addAsync(id, key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<StreamId> add(final K key, final V value, final int trimLen, final boolean trimStrict) {
|
||||
return reactive(new Supplier<RFuture<StreamId>>() {
|
||||
@Override
|
||||
public RFuture<StreamId> get() {
|
||||
return instance.addAsync(key, value, trimLen, trimStrict);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Void> add(final StreamId id, final K key, final V value, final int trimLen, final boolean trimStrict) {
|
||||
return reactive(new Supplier<RFuture<Void>>() {
|
||||
@Override
|
||||
public RFuture<Void> get() {
|
||||
return instance.addAsync(id, key, value, trimLen, trimStrict);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<StreamId> addAll(final Map<K, V> entries) {
|
||||
return reactive(new Supplier<RFuture<StreamId>>() {
|
||||
@Override
|
||||
public RFuture<StreamId> get() {
|
||||
return instance.addAllAsync(entries);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Void> addAll(final StreamId id, final Map<K, V> entries) {
|
||||
return reactive(new Supplier<RFuture<Void>>() {
|
||||
@Override
|
||||
public RFuture<Void> get() {
|
||||
return instance.addAllAsync(id, entries);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<StreamId> addAll(final Map<K, V> entries, final int trimLen, final boolean trimStrict) {
|
||||
return reactive(new Supplier<RFuture<StreamId>>() {
|
||||
@Override
|
||||
public RFuture<StreamId> get() {
|
||||
return instance.addAllAsync(entries, trimLen, trimStrict);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Void> addAll(final StreamId id, final Map<K, V> entries, final int trimLen, final boolean trimStrict) {
|
||||
return reactive(new Supplier<RFuture<Void>>() {
|
||||
@Override
|
||||
public RFuture<Void> get() {
|
||||
return instance.addAllAsync(id, entries, trimLen, trimStrict);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> read(final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readAsync(ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> read(final int count, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readAsync(count, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> read(final long timeout, final TimeUnit unit, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readAsync(timeout, unit, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> read(final int count, final long timeout, final TimeUnit unit, final StreamId... ids) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.readAsync(count, timeout, unit, ids);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final StreamId id, final String name2, final StreamId id2) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(id, name2, id2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final StreamId id, final String name2, final StreamId id2, final String name3,
|
||||
final StreamId id3) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(id, name2, id2, name3, id3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final StreamId id, final Map<String, StreamId> nameToId) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(id, nameToId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final int count, final StreamId id, final String name2, final StreamId id2) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(count, id, name2, id2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final int count, final StreamId id, final String name2, final StreamId id2,
|
||||
final String name3, final StreamId id3) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(count, id, name2, id2, name3, id3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final int count, final StreamId id,
|
||||
final Map<String, StreamId> nameToId) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(count, id, nameToId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final long timeout, final TimeUnit unit, final StreamId id, final String name2,
|
||||
final StreamId id2) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(timeout, unit, id, name2, id2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final long timeout, final TimeUnit unit, final StreamId id, final String name2,
|
||||
final StreamId id2, final String name3, final StreamId id3) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(timeout, unit, id, name2, id2, name3, id3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final long timeout, final TimeUnit unit, final StreamId id,
|
||||
final Map<String, StreamId> nameToId) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(timeout, unit, id, nameToId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final int count, final long timeout, final TimeUnit unit, final StreamId id,
|
||||
final String name2, final StreamId id2) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(count, timeout, unit, id, name2, id2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final int count, final long timeout, final TimeUnit unit, final StreamId id,
|
||||
final String name2, final StreamId id2, final String name3, final StreamId id3) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(count, timeout, unit, id, name2, id2, name3, id3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<String, Map<StreamId, Map<K, V>>>> read(final int count, final long timeout, final TimeUnit unit, final StreamId id,
|
||||
final Map<String, StreamId> nameToId) {
|
||||
return reactive(new Supplier<RFuture<Map<String, Map<StreamId, Map<K, V>>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<String, Map<StreamId, Map<K, V>>>> get() {
|
||||
return instance.readAsync(count, timeout, unit, id, nameToId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> range(final StreamId startId, final StreamId endId) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.rangeAsync(startId, endId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> range(final int count, final StreamId startId, final StreamId endId) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.rangeAsync(count, startId, endId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> rangeReversed(final StreamId startId, final StreamId endId) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.rangeReversedAsync(startId, endId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<StreamId, Map<K, V>>> rangeReversed(final int count, final StreamId startId, final StreamId endId) {
|
||||
return reactive(new Supplier<RFuture<Map<StreamId, Map<K, V>>>>() {
|
||||
@Override
|
||||
public RFuture<Map<StreamId, Map<K, V>>> get() {
|
||||
return instance.rangeReversedAsync(startId, endId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue