Class XReadArgs

  • All Implemented Interfaces:
    CompositeArgument

    public class XReadArgs
    extends Object
    implements CompositeArgument
    Argument list builder for the Redis XREAD and XREADGROUP commands. Static import the methods from XReadArgs.Builder and call the methods: block(…) .

    XReadArgs is a mutable object and instances should be used only once to avoid shared mutable state.

    Since:
    5.1
    Author:
    Mark Paluch
    • Constructor Detail

      • XReadArgs

        public XReadArgs()
    • Method Detail

      • block

        public XReadArgs block​(long milliseconds)
        Perform a blocking read and wait up to milliseconds for a new stream message.
        Parameters:
        milliseconds - max time to wait.
        Returns:
        this.
      • block

        public XReadArgs block​(Duration timeout)
        Perform a blocking read and wait up to a timeout for a new stream message.
        Parameters:
        timeout - max time to wait.
        Returns:
        this.
      • count

        public XReadArgs count​(long count)
        Limit read to count messages.
        Parameters:
        count - number of messages.
        Returns:
        this.
      • noack

        public XReadArgs noack​(boolean noack)
        Use NOACK option to disable auto-acknowledgement. Only valid for XREADGROUP.
        Parameters:
        noack - true to disable auto-ack.
        Returns:
        this.
      • build

        public <K,​V> void build​(CommandArgs<K,​V> args)
        Description copied from interface: CompositeArgument
        Build command arguments and contribute arguments to CommandArgs.

        Implementing classes are required to implement this method. Depending on the command nature and configured arguments, this method may contribute arguments but is not required to add arguments if none are specified.

        Specified by:
        build in interface CompositeArgument
        Type Parameters:
        K - Key type.
        V - Value type.
        Parameters:
        args - the command arguments, must not be null.