Class BlockingTransactionalStreamCommandsImpl<K,​F,​V>

    • Method Detail

      • xack

        public void xack​(K key,
                         String group,
                         String... ids)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XACK. Summary: Marks a pending message as correctly processed, effectively removing it from the pending entries list of the consumer group. Return value of the command is the number of messages successfully acknowledged, that is, the IDs we were actually able to resolve in the PEL.

        The XACK command removes one or multiple messages from the Pending Entries List (PEL) of a stream consumer group. A message is pending, and as such stored inside the PEL, when it was delivered to some consumer, normally as a side effect of calling XREADGROUP, or when a consumer took ownership of a message calling XCLAIM. The pending message was delivered to some consumer but the server is yet not sure it was processed at least once. So new calls to XREADGROUP to grab the messages history for a consumer (for instance using an ID of 0), will return such message. Similarly, the pending message will be listed by the XPENDING command, that inspects the PEL.

        Once a consumer successfully processes a message, it should call XACK so that such message does not get processed again, and as a side effect, the PEL entry about this message is also purged, releasing memory from the Redis server.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xack in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - the key
        group - the name of the consumer group
        ids - the message ids to acknowledge
      • xadd

        public void xadd​(K key,
                         Map<F,​V> payload)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XADD. Summary: Appends the specified stream entry to the stream at the specified key. If the key does not exist, as a side effect of running this command the key is created with a stream value. The creation of stream's key can be disabled with the NOMKSTREAM option.

        An entry is composed of a list of field-value pairs. The field-value pairs are stored in the same order they are given by the user. Commands that read the stream, such as XRANGE or XREAD, are guaranteed to return the fields and values exactly in the same order they were added by XADD.

        XADD is the only Redis command that can add data to a stream, but there are other commands, such as XDEL and XTRIM, that are able to remove data from a stream.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xadd in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - the key
        payload - the payload to write to the stream, must not be null
      • xadd

        public void xadd​(K key,
                         XAddArgs args,
                         Map<F,​V> payload)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XADD. Summary: Appends the specified stream entry to the stream at the specified key. If the key does not exist, as a side effect of running this command the key is created with a stream value. The creation of stream's key can be disabled with the NOMKSTREAM option.

        An entry is composed of a list of field-value pairs. The field-value pairs are stored in the same order they are given by the user. Commands that read the stream, such as XRANGE or XREAD, are guaranteed to return the fields and values exactly in the same order they were added by XADD.

        XADD is the only Redis command that can add data to a stream, but there are other commands, such as XDEL and XTRIM, that are able to remove data from a stream.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xadd in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - the key
        args - the extra parameters
        payload - the payload to write to the stream, must not be null
      • xautoclaim

        public void xautoclaim​(K key,
                               String group,
                               String consumer,
                               Duration minIdleTime,
                               String start)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XAUTOCLAIM. Summary: Changes (or acquires) ownership of messages in a consumer group, as if the messages were delivered to the specified consumer.

        This command transfers ownership of pending stream entries that match the specified criteria. Conceptually, XAUTOCLAIM is equivalent to calling XPENDING and then XCLAIM, but provides a more straightforward way to deal with message delivery failures via SCAN-like semantics.

        Like XCLAIM, the command operates on the stream entries at key and in the context of the provided group. It transfers ownership to @{code consumer} of messages pending for more than min-idle-time milliseconds and having an equal or greater ID than start.

        Group: stream Requires Redis 6.2.0+

        Specified by:
        xautoclaim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        group - string the consumer group
        consumer - string the consumer id
        minIdleTime - the min pending time of the message to claim
        start - the min id of the message to claim
      • xautoclaim

        public void xautoclaim​(K key,
                               String group,
                               String consumer,
                               Duration minIdleTime,
                               String start,
                               int count)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XAUTOCLAIM. Summary: Changes (or acquires) ownership of messages in a consumer group, as if the messages were delivered to the specified consumer.

        This command transfers ownership of pending stream entries that match the specified criteria. Conceptually, XAUTOCLAIM is equivalent to calling XPENDING and then XCLAIM, but provides a more straightforward way to deal with message delivery failures via SCAN-like semantics.

        Like XCLAIM, the command operates on the stream entries at key and in the context of the provided group. It transfers ownership to @{code consumer} of messages pending for more than min-idle-time milliseconds and having an equal or greater ID than start.

        Group: stream Requires Redis 6.2.0+

        Specified by:
        xautoclaim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        group - string the consumer group
        consumer - string the consumer id
        minIdleTime - the min pending time of the message to claim
        start - the min id of the message to claim
        count - the upper limit of the number of entries to claim, default is 100.
      • xautoclaim

        public void xautoclaim​(K key,
                               String group,
                               String consumer,
                               Duration minIdleTime,
                               String start,
                               int count,
                               boolean justId)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XAUTOCLAIM. Summary: Changes (or acquires) ownership of messages in a consumer group, as if the messages were delivered to the specified consumer.

        This command transfers ownership of pending stream entries that match the specified criteria. Conceptually, XAUTOCLAIM is equivalent to calling XPENDING and then XCLAIM, but provides a more straightforward way to deal with message delivery failures via SCAN-like semantics.

        Like XCLAIM, the command operates on the stream entries at key and in the context of the provided group. It transfers ownership to @{code consumer} of messages pending for more than min-idle-time milliseconds and having an equal or greater ID than start.

        Group: stream Requires Redis 6.2.0+

        Specified by:
        xautoclaim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        group - string the consumer group
        consumer - string the consumer id
        minIdleTime - the min pending time of the message to claim
        start - the min id of the message to claim
        count - the upper limit of the number of entries to claim, default is 100.
        justId - if true the returned structure would only contain the id of the messages and not the payloads
      • xclaim

        public void xclaim​(K key,
                           String group,
                           String consumer,
                           Duration minIdleTime,
                           String... id)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XCLAIM. Summary: In the context of a stream consumer group, this command changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xclaim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        group - string the consumer group
        consumer - string the consumer id
        minIdleTime - the min pending time of the message to claim
        id - the message ids to claim, must not be empty, must not contain null
      • xclaim

        public void xclaim​(K key,
                           String group,
                           String consumer,
                           Duration minIdleTime,
                           XClaimArgs args,
                           String... id)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XCLAIM. Summary: In the context of a stream consumer group, this command changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xclaim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        group - string the consumer group
        consumer - string the consumer id
        minIdleTime - the min pending time of the message to claim
        args - the extra command parameters
        id - the message ids to claim, must not be empty, must not contain null
      • xdel

        public void xdel​(K key,
                         String... id)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XDEL. Summary: Removes the specified entries from a stream, and returns the number of entries deleted. This number may be less than the number of IDs passed to the command in the case where some of the specified IDs do not exist in the stream.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xdel in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        id - the message ids, must not be empty, must not contain null
      • xgroupCreate

        public void xgroupCreate​(K key,
                                 String groupname,
                                 String from)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XGROUP CREATE. Summary: Create a new consumer group uniquely identified by groupname for the stream stored at key

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xgroupCreate in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        groupname - the name of the group, must be unique, and not null
        from - the last delivered entry in the stream from the new group's perspective. The special ID $ is the ID of the last entry in the stream, but you can substitute it with any valid ID.
      • xgroupCreate

        public void xgroupCreate​(K key,
                                 String groupname,
                                 String from,
                                 XGroupCreateArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XGROUP CREATE. Summary: Create a new consumer group uniquely identified by groupname for the stream stored at key

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xgroupCreate in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        groupname - the name of the group, must be unique, and not null
        from - the last delivered entry in the stream from the new group's perspective. The special ID $ is the ID of the last entry in the stream, but you can substitute it with any valid ID.
        args - the extra command parameters
      • xgroupCreateConsumer

        public void xgroupCreateConsumer​(K key,
                                         String groupname,
                                         String consumername)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XGROUP CREATECONSUMER. Summary: Create a consumer named consumername in the consumer group groupname of the stream that's stored at key.

        Consumers are also created automatically whenever an operation, such as XREADGROUP, references a consumer that doesn't exist.

        Group: stream Requires Redis 6.2.0+

        Specified by:
        xgroupCreateConsumer in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        groupname - the name of the group, must be unique, and not null
        consumername - the consumer name
      • xgroupDestroy

        public void xgroupDestroy​(K key,
                                  String groupname)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XGROUP DESTROY. Summary: Completely destroys a consumer group. The consumer group will be destroyed even if there are active consumers, and pending messages, so make sure to call this command only when really needed.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xgroupDestroy in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        groupname - the name of the group, must be unique, and not null
      • xgroupSetId

        public void xgroupSetId​(K key,
                                String groupname,
                                String from)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XGROUP SETID. Summary: Set the last delivered ID for a consumer group.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xgroupSetId in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        groupname - the name of the group, must be unique, and not null
        from - the last delivered entry in the stream from the new group's perspective. The special ID $ is the ID of the last entry in the stream, but you can substitute it with any valid ID.
      • xgroupSetId

        public void xgroupSetId​(K key,
                                String groupname,
                                String from,
                                XGroupSetIdArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XGROUP SETID. Summary: Set the last delivered ID for a consumer group.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xgroupSetId in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        groupname - the name of the group, must be unique, and not null
        from - the last delivered entry in the stream from the new group's perspective. The special ID $ is the ID of the last entry in the stream, but you can substitute it with any valid ID.
        args - the extra command parameters
      • xrange

        public void xrange​(K key,
                           StreamRange range,
                           int count)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XRANGE. Summary: The command returns the stream entries matching a given range of IDs.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xrange in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        range - the range, must not be null
        count - the max number of entries to return
      • xrange

        public void xrange​(K key,
                           StreamRange range)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XRANGE. Summary: The command returns the stream entries matching a given range of IDs.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xrange in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        range - the range, must not be null
      • xread

        public void xread​(K key,
                          String id)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREAD. Summary: Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller. This command has an option to block if items are not available, in a similar fashion to BRPOP or BZPOPMIN and others.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xread in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key of the stream
        id - the last read id
      • xread

        public void xread​(Map<K,​String> lastIdsPerStream)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREAD. Summary: Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller. This command has an option to block if items are not available, in a similar fashion to BRPOP or BZPOPMIN and others.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xread in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        lastIdsPerStream - the map of key -> id indicating the last received id per stream to read
      • xread

        public void xread​(K key,
                          String id,
                          XReadArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREAD. Summary: Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller. This command has an option to block if items are not available, in a similar fashion to BRPOP or BZPOPMIN and others.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xread in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key of the stream
        id - the last read id
        args - the extra parameter
      • xread

        public void xread​(Map<K,​String> lastIdsPerStream,
                          XReadArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREAD. Summary: Read data from one or multiple streams, only returning entries with an ID greater than the last received ID reported by the caller. This command has an option to block if items are not available, in a similar fashion to BRPOP or BZPOPMIN and others.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xread in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        lastIdsPerStream - the map of key -> id indicating the last received id per stream to read
        args - the extra parameter
      • xreadgroup

        public void xreadgroup​(String group,
                               String consumer,
                               K key,
                               String id)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREADGROUP. Summary: The XREADGROUP command is a special version of the XREAD command with support for consumer groups.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xreadgroup in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        group - the group name
        consumer - the consumer name
        key - the stream key
        id - the last read id
      • xreadgroup

        public void xreadgroup​(String group,
                               String consumer,
                               Map<K,​String> lastIdsPerStream)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREADGROUP. Summary: The XREADGROUP command is a special version of the XREAD command with support for consumer groups.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xreadgroup in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        group - the group name
        consumer - the consumer name
        lastIdsPerStream - the map of key -> id indicating the last received id per stream to read
      • xreadgroup

        public void xreadgroup​(String group,
                               String consumer,
                               K key,
                               String id,
                               XReadGroupArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREADGROUP. Summary: The XREADGROUP command is a special version of the XREAD command with support for consumer groups.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xreadgroup in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        group - the group name
        consumer - the consumer name
        key - the stream key
        id - the last read id
        args - the extra parameter
      • xreadgroup

        public void xreadgroup​(String group,
                               String consumer,
                               Map<K,​String> lastIdsPerStream,
                               XReadGroupArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREADGROUP. Summary: The XREADGROUP command is a special version of the XREAD command with support for consumer groups.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xreadgroup in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        group - the group name
        consumer - the consumer name
        lastIdsPerStream - the map of key -> id indicating the last received id per stream to read
        args - the extra parameter
      • xrevrange

        public void xrevrange​(K key,
                              StreamRange range,
                              int count)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XREVRANGE. Summary: This command is exactly like XRANGE, but with the notable difference of returning the entries in reverse order, and also taking the start-end range in reverse order: in XREVRANGE you need to state the end ID and later the start ID, and the command will produce all the element between (or exactly like) the two IDs, starting from the end side.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xrevrange in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        range - the range, must not be null
        count - the max number of entries to return
      • xrevrange

        public void xrevrange​(K key,
                              StreamRange range)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XRANGE. Summary: This command is exactly like XRANGE, but with the notable difference of returning the entries in reverse order, and also taking the start-end range in reverse order: in XREVRANGE you need to state the end ID and later the start ID, and the command will produce all the element between (or exactly like) the two IDs, starting from the end side.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xrevrange in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - key the key
        range - the range, must not be null
      • xtrim

        public void xtrim​(K key,
                          String threshold)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XTRIM. Summary: Trims the stream by evicting older entries (entries with lower IDs) if needed.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xtrim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - the key
        threshold - the threshold
      • xtrim

        public void xtrim​(K key,
                          XTrimArgs args)
        Description copied from interface: TransactionalStreamCommands
        Execute the command XTRIM. Summary: Trims the stream by evicting older entries (entries with lower IDs) if needed.

        Group: stream Requires Redis 5.0.0+

        Specified by:
        xtrim in interface TransactionalStreamCommands<K,​F,​V>
        Parameters:
        key - the key
        args - the extra parameters