Interface RStreamReactive<K,V>

Type Parameters:
K - key type
V - value type
All Superinterfaces:
RExpirableReactive, RObjectReactive

public interface RStreamReactive<K,V> extends RExpirableReactive
Reactive interface for Redis Stream object.

Requires Redis 5.0.0 and higher.

Author:
Nikita Koksharov
  • Method Details

    • createGroup

      reactor.core.publisher.Mono<Void> createGroup(StreamCreateGroupArgs args)
      Creates consumer group.

      Usage examples:

       StreamMessageId id = stream.createGroup(StreamCreateGroupArgs.name("test").id(id).makeStream());
       
      Parameters:
      args - method arguments object
    • removeGroup

      reactor.core.publisher.Mono<Void> removeGroup(String groupName)
      Removes group by name.
      Parameters:
      groupName - - name of group
      Returns:
      void
    • createConsumer

      reactor.core.publisher.Mono<Void> createConsumer(String groupName, String consumerName)
      Creates consumer of the group by name.

      Requires Redis 6.2.0 and higher.

      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
    • removeConsumer

      reactor.core.publisher.Mono<Long> removeConsumer(String groupName, String consumerName)
      Removes consumer of the group by name.
      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      Returns:
      number of pending messages owned by consumer
    • updateGroupMessageId

      reactor.core.publisher.Mono<Void> updateGroupMessageId(String groupName, StreamMessageId id)
      Updates next message id delivered to consumers.
      Parameters:
      groupName - - name of group
      id - - Stream Message ID
      Returns:
      void
    • ack

      reactor.core.publisher.Mono<Long> ack(String groupName, StreamMessageId... ids)
      Marks pending messages by group name and stream ids as correctly processed.
      Parameters:
      groupName - - name of group
      ids - - stream ids
      Returns:
      marked messages amount
    • getPendingInfo

      reactor.core.publisher.Mono<PendingResult> getPendingInfo(String groupName)
      Returns common info about pending messages by group name.
      Parameters:
      groupName - - name of group
      Returns:
      result object
    • listPending

      reactor.core.publisher.Mono<List<PendingEntry>> listPending(String groupName, StreamMessageId startId, StreamMessageId endId, int count)
      Returns list of pending messages by group name. Limited by start stream id and end stream id and count.

      StreamMessageId.MAX is used as max stream id StreamMessageId.MIN is used as min stream id

      Parameters:
      groupName - - name of group
      startId - - start stream id
      endId - - end stream id
      count - - amount of messages
      Returns:
      list
    • listPending

      reactor.core.publisher.Mono<List<PendingEntry>> listPending(String groupName, String consumerName, StreamMessageId startId, StreamMessageId 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.

      StreamMessageId.MAX is used as max stream id StreamMessageId.MIN is used as min stream id

      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      startId - - start stream id
      endId - - end stream id
      count - - amount of messages
      Returns:
      list
    • listPending

      reactor.core.publisher.Mono<List<PendingEntry>> listPending(String groupName, StreamMessageId startId, StreamMessageId endId, long idleTime, TimeUnit idleTimeUnit, int count)
      Returns list of common info about pending messages by group name. Limited by minimum idle time, messages count, start and end Stream Message IDs.

      StreamMessageId.MAX is used as max Stream Message ID StreamMessageId.MIN is used as min Stream Message ID

      Requires Redis 6.2.0 and higher.

      Parameters:
      groupName - - name of group
      startId - - start Stream Message ID
      endId - - end Stream Message ID
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      count - - amount of messages
      Returns:
      list
      See Also:
    • listPending

      reactor.core.publisher.Mono<List<PendingEntry>> listPending(String groupName, String consumerName, StreamMessageId startId, StreamMessageId endId, long idleTime, TimeUnit idleTimeUnit, int count)
      Returns list of common info about pending messages by group and consumer name. Limited by minimum idle time, messages count, start and end Stream Message IDs.

      StreamMessageId.MAX is used as max Stream Message ID StreamMessageId.MIN is used as min Stream Message ID

      Requires Redis 6.2.0 and higher.

      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      startId - - start Stream Message ID
      endId - - end Stream Message ID
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      count - - amount of messages
      Returns:
      list
      See Also:
    • pendingRange

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> pendingRange(String groupName, StreamMessageId startId, StreamMessageId endId, long idleTime, TimeUnit idleTimeUnit, int count)
      Returns stream data of pending messages by group name. Limited by minimum idle time, messages count, start and end Stream Message IDs.

      StreamMessageId.MAX is used as max Stream Message ID StreamMessageId.MIN is used as min Stream Message ID

      Requires Redis 6.2.0 and higher.

      Parameters:
      groupName - - name of group
      startId - - start Stream Message ID
      endId - - end Stream Message ID
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      count - - amount of messages
      Returns:
      map
      See Also:
    • pendingRange

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> pendingRange(String groupName, String consumerName, StreamMessageId startId, StreamMessageId endId, long idleTime, TimeUnit idleTimeUnit, int count)
      Returns stream data of pending messages by group and customer name. Limited by minimum idle time, messages count, start and end Stream Message IDs.

      StreamMessageId.MAX is used as max Stream Message ID StreamMessageId.MIN is used as min Stream Message ID

      Requires Redis 6.2.0 and higher.

      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      startId - - start Stream Message ID
      endId - - end Stream Message ID
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      count - - amount of messages
      Returns:
      map
      See Also:
    • claim

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> claim(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit, StreamMessageId... ids)
      Transfers ownership of pending messages by id to a new consumer by name if idle time of messages is greater than defined value.
      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      ids - - stream ids
      Returns:
      stream data mapped by Stream ID
    • autoClaim

      reactor.core.publisher.Mono<AutoClaimResult<K,V>> autoClaim(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit, StreamMessageId startId, int count)
      Transfers ownership of pending messages by id to a new consumer by name if idle time of messages and startId are greater than defined value.
      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      startId - - start Stream Message ID
      Returns:
      stream data mapped by Stream ID
    • fastAutoClaim

      reactor.core.publisher.Mono<FastAutoClaimResult> fastAutoClaim(String groupName, String consumerName, long idleTime, TimeUnit idleTimeUnit, StreamMessageId startId, int count)
      Transfers ownership of pending messages by id to a new consumer by name if idle time of messages and startId are greater than defined value.
      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      idleTime - - minimum idle time of messages
      idleTimeUnit - - idle time unit
      startId - - start Stream Message ID
      Returns:
      list of Stream Message IDs
    • readGroup

      reactor.core.publisher.Mono<Map<String,Map<StreamMessageId,Map<K,V>>>> readGroup(String groupName, String consumerName, StreamMultiReadGroupArgs args)
      Read stream data from consumer group and multiple streams including current.

      Usage examples:

       Map result = stream.read("group1", "consumer1",  StreamMultiReadGroupArgs.greaterThan(id, "stream2", id2));
       
       Map result = stream.read("group1", "consumer1", StreamMultiReadGroupArgs.greaterThan(id, "stream2", id2)
                                                                                .count(100)
                                                                                .timeout(Duration.ofSeconds(5))));
       
      Parameters:
      args - - method arguments object
      Returns:
      stream data mapped by stream name and Stream Message ID
    • readGroup

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> readGroup(String groupName, String consumerName, StreamReadGroupArgs args)
      Read stream data from consumer group and current stream only.

      Usage examples:

       Map result = stream.read("group1", "consumer1",  StreamReadGroupArgs.greaterThan(id));
       
       Map result = stream.read("group1", "consumer1", StreamReadGroupArgs.greaterThan(id)
                                                                                .count(100)
                                                                                .timeout(Duration.ofSeconds(5))));
       
      Parameters:
      args - - method arguments object
      Returns:
      stream data mapped by Stream Message ID
    • size

      reactor.core.publisher.Mono<Long> size()
      Returns number of entries in stream
      Returns:
      size of stream
    • add

      reactor.core.publisher.Mono<StreamMessageId> add(StreamAddArgs<K,V> args)
      Appends a new entry/entries and returns generated Stream Message ID

      Usage examples:

       StreamMessageId id = stream.add(StreamAddArgs.entry(15, 37));
       
       StreamMessageId id = stream.add(StreamAddArgs.entries(15, 37, 23, 43)
                                       .trim(TrimStrategy.MAXLEN, 100)));
       
      Parameters:
      args - - method arguments object
      Returns:
      Stream Message ID
    • add

      reactor.core.publisher.Mono<Void> add(StreamMessageId id, StreamAddArgs<K,V> args)
      Appends a new entry/entries by specified Stream Message ID

      Usage examples:

       stream.add(id, StreamAddArgs.entry(15, 37));
       
       stream.add(id, StreamAddArgs.entries(15, 37, 23, 43)
                                       .trim(TrimStrategy.MAXLEN, 100)));
       
      Parameters:
      id - - Stream Message ID
      args - - method arguments object
    • read

      reactor.core.publisher.Mono<Map<String,Map<StreamMessageId,Map<K,V>>>> read(StreamMultiReadArgs args)
      Read stream data from multiple streams including current.

      Usage examples:

       Map result = stream.read(StreamMultiReadArgs.greaterThan(id, "stream2", id2));
       
       Map result = stream.read(StreamMultiReadArgs.greaterThan(id, "stream2", id2)
                                       .count(100)
                                       .timeout(Duration.ofSeconds(5))));
       
      Parameters:
      args - - method arguments object
      Returns:
      stream data mapped by stream name and Stream Message ID
    • read

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> read(StreamReadArgs args)
      Read stream data from current stream only.

      Usage examples:

       Map result = stream.read(StreamReadArgs.greaterThan(id));
       
       Map result = stream.read(StreamReadArgs.greaterThan(id)
                                       .count(100)
                                       .timeout(Duration.ofSeconds(5))));
       
      Parameters:
      args - - method arguments object
      Returns:
      stream data mapped by Stream Message ID
    • range

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> range(StreamMessageId startId, StreamMessageId endId)
      Returns stream data in range by specified start Stream ID (included) and end Stream ID (included).
      Parameters:
      startId - - start Stream ID
      endId - - end Stream ID
      Returns:
      stream data mapped by Stream ID
    • range

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> range(int count, StreamMessageId startId, StreamMessageId endId)
      Returns stream data in range by specified start Stream ID (included) and end Stream ID (included).
      Parameters:
      count - - stream data size limit
      startId - - start Stream ID
      endId - - end Stream ID
      Returns:
      stream data mapped by Stream ID
    • rangeReversed

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> rangeReversed(StreamMessageId startId, StreamMessageId endId)
      Returns stream data in reverse order in range by specified start Stream ID (included) and end Stream ID (included).
      Parameters:
      startId - - start Stream ID
      endId - - end Stream ID
      Returns:
      stream data mapped by Stream ID
    • rangeReversed

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> rangeReversed(int count, StreamMessageId startId, StreamMessageId endId)
      Returns stream data in reverse order in range by specified start Stream ID (included) and end Stream ID (included).
      Parameters:
      count - - stream data size limit
      startId - - start Stream ID
      endId - - end Stream ID
      Returns:
      stream data mapped by Stream ID
    • remove

      reactor.core.publisher.Mono<Long> remove(StreamMessageId... ids)
      Removes messages by id.
      Parameters:
      ids - - id of messages to remove
      Returns:
      deleted messages amount
    • trim

      reactor.core.publisher.Mono<Long> trim(StreamTrimArgs args)
      Trims stream using strict trimming.
      Parameters:
      args - - method arguments object
      Returns:
      number of deleted messages
    • trimNonStrict

      reactor.core.publisher.Mono<Long> trimNonStrict(StreamTrimArgs args)
      Trims stream using non-strict trimming.
      Parameters:
      args - - method arguments object
      Returns:
      number of deleted messages
    • getInfo

      reactor.core.publisher.Mono<StreamInfo<K,V>> getInfo()
      Returns information about this stream.
      Returns:
      info object
    • listGroups

      reactor.core.publisher.Mono<List<StreamGroup>> listGroups()
      Returns list of objects with information about groups belonging to this stream.
      Returns:
      list of info objects
    • listConsumers

      reactor.core.publisher.Mono<List<StreamConsumer>> listConsumers(String groupName)
      Returns list of objects with information about group customers for specified groupName.
      Parameters:
      groupName - - name of group
      Returns:
      list of info objects
    • pendingRange

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> pendingRange(String groupName, StreamMessageId startId, StreamMessageId endId, int count)
      Returns stream data of pending messages by group name. Limited by start Stream Message ID and end Stream Message ID and count.

      StreamMessageId.MAX is used as max Stream Message ID StreamMessageId.MIN is used as min Stream Message ID

      Parameters:
      groupName - - name of group
      startId - - start Stream Message ID
      endId - - end Stream Message ID
      count - - amount of messages
      Returns:
      map
      See Also:
    • pendingRange

      reactor.core.publisher.Mono<Map<StreamMessageId,Map<K,V>>> pendingRange(String groupName, String consumerName, StreamMessageId startId, StreamMessageId endId, int count)
      Returns stream data of pending messages by group and customer name. Limited by start Stream Message ID and end Stream Message ID and count.

      StreamMessageId.MAX is used as max Stream Message ID StreamMessageId.MIN is used as min Stream Message ID

      Parameters:
      groupName - - name of group
      consumerName - - name of consumer
      startId - - start Stream Message ID
      endId - - end Stream Message ID
      count - - amount of messages
      Returns:
      map
      See Also:
    • addListener

      reactor.core.publisher.Mono<Integer> addListener(ObjectListener listener)
      Adds object event listener
      Specified by:
      addListener in interface RObjectReactive
      Parameters:
      listener - object event listener
      Returns:
      listener id
      See Also: