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 Detail

      • createGroup

        org.reactivestreams.Publisher<Void> createGroup​(String groupName)
        Creates consumer group by name.
        Parameters:
        groupName - - name of group
        Returns:
        void
      • createGroup

        org.reactivestreams.Publisher<Void> createGroup​(String groupName,
                                                        StreamId id)
        Creates consumer group by name and stream id. Only new messages after defined stream id will be available for consumers of this group.

        StreamId.NEWEST is used for messages arrived since the moment of group creating

        Parameters:
        groupName - - name of group
        Returns:
        void
      • ack

        org.reactivestreams.Publisher<Long> ack​(String groupName,
                                                StreamId... 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
      • listPending

        org.reactivestreams.Publisher<PendingResult> listPending​(String groupName)
        Returns pending messages by group name
        Parameters:
        groupName - - name of group
        Returns:
        result object
      • listPending

        org.reactivestreams.Publisher<List<PendingEntry>> listPending​(String groupName,
                                                                      StreamId startId,
                                                                      StreamId endId,
                                                                      int count)
        Returns list of pending messages by group name. Limited by start stream id and end stream id and count.

        StreamId.MAX is used as max stream id StreamId.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

        org.reactivestreams.Publisher<List<PendingEntry>> listPending​(String groupName,
                                                                      StreamId startId,
                                                                      StreamId endId,
                                                                      int count,
                                                                      String consumerName)
        Returns list of pending messages by group name and consumer name. Limited by start stream id and end stream id and count.

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

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

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> claim​(String groupName,
                                                                                String consumerName,
                                                                                long idleTime,
                                                                                TimeUnit idleTimeUnit,
                                                                                StreamId... 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:
      • readGroup

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> readGroup​(String groupName,
                                                                                    String consumerName,
                                                                                    StreamId... ids)
        Read stream data from groupName by consumerName and specified collection of Stream IDs.
        Parameters:
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • readGroup

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> readGroup​(String groupName,
                                                                                    String consumerName,
                                                                                    int count,
                                                                                    StreamId... ids)
        Read stream data from groupName by consumerName and specified collection of Stream IDs.
        Parameters:
        count - - stream data size limit
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • readGroup

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> readGroup​(String groupName,
                                                                                    String consumerName,
                                                                                    long timeout,
                                                                                    TimeUnit unit,
                                                                                    StreamId... ids)
        Read stream data from groupName by consumerName and specified collection of Stream IDs. Wait for stream data availability for specified timeout interval.
        Parameters:
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • readGroup

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> readGroup​(String groupName,
                                                                                    String consumerName,
                                                                                    int count,
                                                                                    long timeout,
                                                                                    TimeUnit unit,
                                                                                    StreamId... ids)
        Read stream data from groupName by consumerName and specified collection of Stream IDs. Wait for stream data availability for specified timeout interval.
        Parameters:
        count - - stream data size limit
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • size

        org.reactivestreams.Publisher<Long> size()
        Returns number of entries in stream
        Returns:
        size of stream
      • add

        org.reactivestreams.Publisher<StreamId> add​(K key,
                                                    V value)
        Appends a new entry and returns generated Stream ID
        Parameters:
        key - - key of entry
        value - - value of entry
        Returns:
        Stream ID
      • add

        org.reactivestreams.Publisher<Void> add​(StreamId id,
                                                K key,
                                                V value)
        Appends a new entry by specified Stream ID
        Parameters:
        id - - Stream ID
        key - - key of entry
        value - - value of entry
        Returns:
        void
      • add

        org.reactivestreams.Publisher<StreamId> add​(K key,
                                                    V value,
                                                    int trimLen,
                                                    boolean trimStrict)
        Appends a new entry and returns generated Stream ID. Trims stream to a specified trimLen size. If trimStrict is false then trims to few tens of entries more than specified length to trim.
        Parameters:
        key - - key of entry
        value - - value of entry
        trimLen - - length to trim
        trimStrict - - if false then trims to few tens of entries more than specified length to trim
        Returns:
        Stream ID
      • add

        org.reactivestreams.Publisher<Void> add​(StreamId id,
                                                K key,
                                                V value,
                                                int trimLen,
                                                boolean trimStrict)
        Appends a new entry by specified Stream ID. Trims stream to a specified trimLen size. If trimStrict is false then trims to few tens of entries more than specified length to trim.
        Parameters:
        id - - Stream ID
        key - - key of entry
        value - - value of entry
        trimLen - - length to trim
        trimStrict - - if false then trims to few tens of entries more than specified length to trim
        Returns:
        void
      • addAll

        org.reactivestreams.Publisher<StreamId> addAll​(Map<K,​V> entries)
        Appends new entries and returns generated Stream ID
        Parameters:
        entries - - entries to add
        Returns:
        Stream ID
      • addAll

        org.reactivestreams.Publisher<Void> addAll​(StreamId id,
                                                   Map<K,​V> entries)
        Appends new entries by specified Stream ID
        Parameters:
        id - - Stream ID
        entries - - entries to add
        Returns:
        void
      • addAll

        org.reactivestreams.Publisher<StreamId> addAll​(Map<K,​V> entries,
                                                       int trimLen,
                                                       boolean trimStrict)
        Appends new entries and returns generated Stream ID. Trims stream to a specified trimLen size. If trimStrict is false then trims to few tens of entries more than specified length to trim.
        Parameters:
        entries - - entries to add
        trimLen - - length to trim
        trimStrict - - if false then trims to few tens of entries more than specified length to trim
        Returns:
        Stream ID
      • addAll

        org.reactivestreams.Publisher<Void> addAll​(StreamId id,
                                                   Map<K,​V> entries,
                                                   int trimLen,
                                                   boolean trimStrict)
        Appends new entries by specified Stream ID. Trims stream to a specified trimLen size. If trimStrict is false then trims to few tens of entries more than specified length to trim.
        Parameters:
        id - - Stream ID
        entries - - entries to add
        trimLen - - length to trim
        trimStrict - - if false then trims to few tens of entries more than specified length to trim
        Returns:
        void
      • read

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> read​(StreamId... ids)
        Read stream data by specified collection of Stream IDs.
        Parameters:
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • read

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> read​(int count,
                                                                               StreamId... ids)
        Read stream data by specified collection of Stream IDs.
        Parameters:
        count - - stream data size limit
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • read

        org.reactivestreams.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 timeout interval.
        Parameters:
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • read

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> read​(int count,
                                                                               long timeout,
                                                                               TimeUnit unit,
                                                                               StreamId... ids)
        Read stream data by specified collection of Stream IDs. Wait for stream data availability for specified timeout interval.
        Parameters:
        count - - stream data size limit
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        ids - - collection of Stream IDs
        Returns:
        stream data mapped by Stream ID
      • read

        org.reactivestreams.Publisher<Map<String,​Map<StreamId,​Map<K,​V>>>> read​(StreamId id,
                                                                                                 String name2,
                                                                                                 StreamId id2)
        Read stream data by specified stream name including this stream.
        Parameters:
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 names including this stream.
        Parameters:
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        name3 - - name of third stream
        id3 - - id of third stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.Publisher<Map<String,​Map<StreamId,​Map<K,​V>>>> read​(StreamId id,
                                                                                                 Map<String,​StreamId> nameToId)
        Read stream data by specified stream id mapped by name including this stream.
        Parameters:
        id - - id of this stream
        nameToId - - stream id mapped by name
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.Publisher<Map<String,​Map<StreamId,​Map<K,​V>>>> read​(int count,
                                                                                                 StreamId id,
                                                                                                 String name2,
                                                                                                 StreamId id2)
        Read stream data by specified stream name including this stream.
        Parameters:
        count - - stream data size limit
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 names including this stream.
        Parameters:
        count - - stream data size limit
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        name3 - - name of third stream
        id3 - - id of third stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.Publisher<Map<String,​Map<StreamId,​Map<K,​V>>>> read​(int count,
                                                                                                 StreamId id,
                                                                                                 Map<String,​StreamId> nameToId)
        Read stream data by specified stream id mapped by name including this stream.
        Parameters:
        count - - stream data size limit
        id - - id of this stream
        nameToId - - stream id mapped by name
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 name including this stream. Wait for the first stream data availability for specified timeout interval.
        Parameters:
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 names including this stream. Wait for the first stream data availability for specified timeout interval.
        Parameters:
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        name3 - - name of third stream
        id3 - - id of third stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 id mapped by name including this stream. Wait for the first stream data availability for specified timeout interval.
        Parameters:
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        id - - id of this stream
        nameToId - - stream id mapped by name
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 name including this stream. Wait for the first stream data availability for specified timeout interval.
        Parameters:
        count - - stream data size limit
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.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 names including this stream. Wait for the first stream data availability for specified timeout interval.
        Parameters:
        count - - stream data size limit
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        id - - id of this stream
        name2 - - name of second stream
        id2 - - id of second stream
        name3 - - name of third stream
        id3 - - id of third stream
        Returns:
        stream data mapped by key and Stream ID
      • read

        org.reactivestreams.Publisher<Map<String,​Map<StreamId,​Map<K,​V>>>> read​(int count,
                                                                                                 long timeout,
                                                                                                 TimeUnit unit,
                                                                                                 StreamId id,
                                                                                                 Map<String,​StreamId> nameToId)
        Read stream data by specified stream id mapped by name including this stream. Wait for the first stream data availability for specified timeout interval.
        Parameters:
        count - - stream data size limit
        timeout - - time interval to wait for stream data availability
        unit - - time interval unit
        id - - id of this stream
        nameToId - - stream id mapped by name
        Returns:
        stream data mapped by key and Stream ID
      • range

        org.reactivestreams.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).
        Parameters:
        startId - - start Stream ID
        endId - - end Stream ID
        Returns:
        stream data mapped by Stream ID
      • range

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> range​(int count,
                                                                                StreamId startId,
                                                                                StreamId endId)
        Read 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

        org.reactivestreams.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).
        Parameters:
        startId - - start Stream ID
        endId - - end Stream ID
        Returns:
        stream data mapped by Stream ID
      • rangeReversed

        org.reactivestreams.Publisher<Map<StreamId,​Map<K,​V>>> rangeReversed​(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).
        Parameters:
        count - - stream data size limit
        startId - - start Stream ID
        endId - - end Stream ID
        Returns:
        stream data mapped by Stream ID