• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

/usr/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(+Redis, +Streams, +Options)
Listen using XREAD on one or more Streams on the server Redis. For each message that arrives, call broadcast/1, where Data is a dict representing the message.
broadcast(redis(Redis, Stream, Id, Data))

Options:

count(+Count)
Process at most Count messages per stream for each request.
start(+Start)
Normally either 0 to start get all messages from the epoch or $ to get messages starting with the last. Default is $.
starts(+List)
May be used as an alternative to the start/1 option to specify the start for each stream. This may be used to restart listening if the application remembers the last processed id.

Note that this predicate does not terminate. It is normally executed in a thread. The following call listens to the streams key1 and key2 on the default Redis server. Using reconnect(true), the client will try to re-establish a connection if the collection got lost.

?- redis_connect(default, C, [reconnect(true)]),
   thread_create(xlisten(C, [key1, key2], [start($)]),
                 _, [detached(true)]).
Arguments:
Redis- is either a Redis server name (see redis_server/3) or an open connection. If it is a server name, a new connection is opened that is closed if xlisten/3 completes.
See also
- redis_subscribe/2 implements the classical pub/sub system of Redis that does not have any memory.
ClioPatria (version V3.1.1-51-ga0b30a5)