/usr/local/lib/swipl/library/ext/redis/redis_streams.pl
All Application Manual Name SummaryHelp

  • ext
    • redis
      • redis.pl -- Redis client
      • redis_streams.pl -- Using Redis streams
        • xstream_set/3
        • xadd/4
        • xlisten/3
        • xlisten_group/5
        • xconsumer_stop/1
        • xhook/2
 xlisten_group(+Redis, +Group, +Consumer, +Streams, +Options)
Listen as Consumer to Group. This is similar to xlisten/3, with the following differences:
  • Instead of using broadcast/1, broadcast_request/1 is used and the message is only considered processed if broadcast_request/1 succeeds. If the message is handled with success, an XACK is sent to the server.

Options processed:

block(+Seconds)
Causes XREADGROUP to return with timeout when no messages arrive within Seconds. On a timeout, xidle_group/5 is called which will try to handle messages to other consumers pending longer than Seconds. Choosing the time depends on the application. Notably:
  • Using a time shorter than the required processing time will make the job migrate from consumer to consumer until max_deliveries(Count) is exceeded. Note that the original receiver does not notice that the job is claimed and thus multiple consumers may ultimately answer the message.
  • Using a too long time causes an unnecessarily long delay if a node fails.
max_deliveries(+Count)
Re-deliver (using XCLAIM) a message max Count times. Exceeding this calls xhook/2. Default Count is 3.
max_claim(+Count)
Do not claim more than Count messages during a single idle action. Default is 10.