On this page:
redis-stream-entry
redis-stream-entry/  pending
redis-stream-info
redis-stream-group
redis-stream-consumer
redis-stream-ack!
redis-stream-add!
redis-stream-consumer-remove!
redis-stream-consumers
redis-stream-get
redis-stream-group-create!
redis-stream-group-read!
redis-stream-group-remove!
redis-stream-group-set-id!
redis-stream-groups
redis-stream-length
redis-stream-read!
redis-stream-remove!
redis-stream-trim!
redis-substream
redis-substream/  group

17 Stream Commands

struct

(struct redis-stream-entry (id fields)
    #:extra-constructor-name make-redis-stream-entry)
  id : bytes?
  fields : (hash/c bytes? bytes?)
A struct representing individual entries within a stream.

struct

(struct redis-stream-entry/pending (id
    consumer
    elapsed-time
    delivery-count)
    #:extra-constructor-name make-redis-stream-entry/pending)
  id : bytes?
  consumer : bytes?
  elapsed-time : exact-nonnegative-integer?
  delivery-count : exact-positive-integer?
A struct representing pending entries within a stream group.

struct

(struct redis-stream-info (length
    radix-tree-keys
    radix-tree-nodes
    groups
    last-generated-id
    first-entry
    last-entry)
    #:extra-constructor-name make-redis-stream-info)
  length : exact-nonnegative-integer?
  radix-tree-keys : exact-nonnegative-integer?
  radix-tree-nodes : exact-nonnegative-integer?
  groups : exact-nonnegative-integer?
  last-generated-id : bytes?
  first-entry : redis-stream-entry?
  last-entry : redis-stream-entry?
A struct representing information about a stream.

struct

(struct redis-stream-group (name consumers pending)
    #:extra-constructor-name make-redis-stream-group)
  name : bytes?
  consumers : exact-nonnegative-integer?
  pending : exact-nonnegative-integer?
A struct representing an individual stream group.

struct

(struct redis-stream-consumer (name idle pending)
    #:extra-constructor-name make-redis-stream-consumer)
  name : bytes?
  idle : exact-nonnegative-integer?
  pending : exact-nonnegative-integer?
A struct representing an individual stream consumer.

procedure

(redis-stream-ack! client key group id ...+)

  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  group : redis-string/c
  id : redis-string/c
Acknowledges all of the messages represented by the given ids within the group belonging to the stream at key and returns the total number of acknowledged messages.
Commands used by this function: XACK

procedure

(redis-stream-add! 
  client 
  key 
  flds-and-vals ...+ 
  [#:id id] 
  #:max-length max-length 
  #:max-length/approximate max-length/approximate) 
  bytes?
  client : redis?
  key : redis-key/c
  flds-and-vals : redis-string/c
  id : redis-string/c = "*"
  max-length : exact-positive-integer?
  max-length/approximate : exact-positive-integer?
Adds an entry to the stream at key with fields flds-and-vals. flds-and-vals must contain an even number of items (one field name and one value for each field).

See the Redis documentation for the value of the id parameter.

Either max-length or max-length/approximate can be provided, but not both.
Commands used by this function: XADD

procedure

(redis-stream-consumer-remove! client    
  key    
  group    
  consumer)  boolean?
  client : redis?
  key : redis-key/c
  group : redis-string/c
  consumer : redis-string/c
Removes consumer from the stream group named group belonging to the stream at key.
Commands used by this function: XGROUP_DELCONSUMER

procedure

(redis-stream-consumers client key group)

  (listof redis-stream-consumer?)
  client : redis?
  key : redis-key/c
  group : redis-string/c
Returns all of the consumers belonging to the group of the stream at key.
Commands used by this function: XINFO_CONSUMERS

procedure

(redis-stream-get client key)  redis-stream-info?

  client : redis?
  key : redis-key/c
Returns information about the stream at key.
Commands used by this function: XINFO_STREAM

procedure

(redis-stream-group-create! client    
  key    
  group    
  starting-id)  boolean?
  client : redis?
  key : redis-key/c
  group : redis-string/c
  starting-id : redis-string/c
Creates a stream group called group for the stream at key.
Commands used by this function: XGROUP_CREATE

procedure

(redis-stream-group-read! client 
  #:streams streams 
  #:group group 
  #:consumer consumer 
  [#:limit limit 
  #:block? block? 
  #:timeout timeout 
  #:no-ack? no-ack?]) 
  (or/c false/c (listof (list/c bytes? (listof redis-stream-entry?))))
  client : redis?
  streams : (non-empty-listof (cons/c redis-key/c (or/c 'new-entries redis-string/c)))
  group : redis-string/c
  consumer : redis-string/c
  limit : (or/c false/c exact-positive-integer?) = #f
  block? : boolean? = #f
  timeout : exact-nonnegative-integer? = 0
  no-ack? : boolean? = #f
Reads entries from a stream group for every stream and id pair given via the streams alist and returns a list of lists where the first element of each sublist is the name of the stream and the second is the list of entries retrieved for that stream.

The special 'new-entries id value maps to the special id ">", meaning that only entries that haven’t yet been retrieved by this consumer should be returned.
Commands used by this function: XREADGROUP

procedure

(redis-stream-group-remove! client    
  key    
  group)  boolean?
  client : redis?
  key : redis-key/c
  group : redis-string/c
Removes the group named group from the stream at key.
Commands used by this function: XGROUP_REMOVE

procedure

(redis-stream-group-set-id! client    
  key    
  group    
  id)  boolean?
  client : redis?
  key : redis-key/c
  group : redis-string/c
  id : redis-string/c
Sets the starting id for the stream group named group belonging to the stream at key.
Commands used by this function: XGROUP_SETID

procedure

(redis-stream-groups client key)  (listof redis-stream-group?)

  client : redis?
  key : redis-key/c
Returns all of the groups belonging to the stream at key.
Commands used by this function: XINFO_GROUPS

procedure

(redis-stream-length client key)  exact-nonnegative-integer?

  client : redis?
  key : redis-key/c
Returns the length of the stream at key.
Commands used by this function: XLEN

procedure

(redis-stream-read! client 
  #:streams streams 
  [#:limit limit 
  #:block? block? 
  #:timeout timeout]) 
  (or/c false/c (listof (list/c bytes? (listof redis-stream-entry?))))
  client : redis?
  streams : (non-empty-listof (cons/c redis-key/c (or/c 'new-entries redis-string/c)))
  limit : (or/c false/c exact-positive-integer?) = #f
  block? : boolean? = #f
  timeout : exact-nonnegative-integer? = 0
Reads entries from every stream and id pair given via the streams alist and returns a list of lists where the first element of each sublist is the name of the stream and the second is the list of entries retrieved for that stream.

The special 'new-entries id value maps to the special id "$", meaning that only entries added after the read was initiated should be retrieved.
Commands used by this function: XREAD

procedure

(redis-stream-remove! client key id ...+)

  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  id : redis-string/c
Removes the entries represented by each id from the stream at key, returning the total number of removed entries.
Commands used by this function: XDEL

procedure

(redis-stream-trim! 
  client 
  key 
  #:max-length max-length 
  #:max-length/approximate max-length/approximate) 
  exact-nonnegative-integer?
  client : redis?
  key : redis-key/c
  max-length : exact-positive-integer?
  max-length/approximate : exact-positive-integer?
Trims the stream at key to either max-length or max-length/approximate. Usually, you will want to use the latter for performance. Either keyword argument must be provided but not both.
Commands used by this function: XTRIM

procedure

(redis-substream client 
  key 
  [#:reverse? reverse?] 
  #:start start 
  #:stop stop 
  #:limit limit) 
  (listof redis-stream-entry?)
  client : redis?
  key : redis-key/c
  reverse? : boolean? = #f
  start : (or/c 'first-entry 'last-entry redis-string/c)
  stop : (or/c 'first-entry 'last-entry redis-string/c)
  limit : (or/c false/c exact-positive-integer?)
Returns at most limit entries between start and stop from the stream at key. If limit is #f, then all the entries are returned.

start and stop accept a stream entry id or one of the special values 'first-entry and 'last-entry, which map to the special ids "-" and "+", respectively, which mean the very first and the very last item in the stream.

When reverse? is #t the entries are returned in reverse order and start and stop are swapped.
Commands used by this function: XRANGE

procedure

(redis-substream/group client 
  key 
  group 
  [#:start start 
  #:stop stop 
  #:limit limit]) 
  (listof redis-stream-entry/pending?)
  client : redis?
  key : redis-key/c
  group : redis-string/c
  start : (or/c 'first-entry 'last-entry redis-string/c)
   = 'first-entry
  stop : (or/c 'first-entry 'last-entry redis-string/c)
   = 'last-entry
  limit : exact-positive-integer? = 10
Retrieves limit pending entries for the group belonging to the stream at key between start and stop.
Commands used by this function: XPENDING