Class RedisConnection

java.lang.Object
io.vertx.mutiny.redis.client.RedisConnection
All Implemented Interfaces:
MutinyDelegate, ReadStream<io.vertx.redis.client.Response>, StreamBase

public class RedisConnection extends Object implements ReadStream<io.vertx.redis.client.Response>, MutinyDelegate
A simple Redis client.

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

See Also:
  • RedisConnection
  • Field Details

  • Constructor Details

    • RedisConnection

      public RedisConnection(io.vertx.redis.client.RedisConnection delegate)
      Create a new instance of RedisConnection delegating to the given (non-null) instance of RedisConnection.
    • RedisConnection

      public RedisConnection(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.redis.client.RedisConnection getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Specified by:
      getDelegate in interface ReadStream<io.vertx.redis.client.Response>
      Specified by:
      getDelegate in interface StreamBase
      Returns:
      the delegate instance
    • send

      @CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.redis.client.Response> send(io.vertx.redis.client.Request command)
      Send the given command to the redis server or cluster.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      command - the command to send
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • RedisConnection.send(Request)
    • sendAndAwait

      public io.vertx.redis.client.Response sendAndAwait(io.vertx.redis.client.Request command)
      Send the given command to the redis server or cluster.

      Unlike the bare Vert.x variant, this method returns a Response. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      command - the command to send
      Returns:
      The operation result
      See Also:
      • RedisConnection.send(Request)
    • sendAndForget

      public RedisConnection sendAndForget(io.vertx.redis.client.Request command)
      Send the given command to the redis server or cluster.

      Unlike the bare Vert.x variant, this method ignores the Response result or any failure.

      Parameters:
      command - the command to send
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • RedisConnection.send(Request)
    • batch

      @CheckReturnValue public io.smallrye.mutiny.Uni<List<io.vertx.redis.client.Response>> batch(List<io.vertx.redis.client.Request> commands)
      Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      commands - list of command to send
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • RedisConnection.batch(List)
    • batchAndAwait

      public List<io.vertx.redis.client.Response> batchAndAwait(List<io.vertx.redis.client.Request> commands)
      Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.

      Unlike the bare Vert.x variant, this method returns a List<io.vertx.redis.client.Response>. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      commands - list of command to send
      Returns:
      The operation result
      See Also:
      • RedisConnection.batch(List)
    • batchAndForget

      public RedisConnection batchAndForget(List<io.vertx.redis.client.Request> commands)
      Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.

      Unlike the bare Vert.x variant, this method ignores the List<io.vertx.redis.client.Response> result or any failure.

      Parameters:
      commands - list of command to send
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • RedisConnection.batch(List)
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Closes the connection or returns to the pool.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • RedisConnection.close()
    • closeAndAwait

      public void closeAndAwait()
      Closes the connection or returns to the pool.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • RedisConnection.close()
    • closeAndForget

      public RedisConnection closeAndForget()
      Closes the connection or returns to the pool.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • RedisConnection.close()
    • pipeTo

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<io.vertx.redis.client.Response> dst)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Specified by:
      pipeTo in interface ReadStream<io.vertx.redis.client.Response>
      Parameters:
      dst - the destination write stream
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • io.vertx.redis.client.RedisConnection#pipeTo(WriteStream)
    • pipeToAndAwait

      public void pipeToAndAwait(WriteStream<io.vertx.redis.client.Response> dst)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      dst - the destination write stream
      See Also:
      • io.vertx.redis.client.RedisConnection#pipeTo(WriteStream)
    • pipeToAndForget

      public RedisConnection pipeToAndForget(WriteStream<io.vertx.redis.client.Response> dst)
      Pipe this ReadStream to the WriteStream.

      Elements emitted by this stream will be written to the write stream until this stream ends or fails.

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Parameters:
      dst - the destination write stream
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • io.vertx.redis.client.RedisConnection#pipeTo(WriteStream)
    • exceptionHandler

      public RedisConnection exceptionHandler(Consumer<Throwable> handler)
      Set an exception handler on the read stream.
      Specified by:
      exceptionHandler in interface ReadStream<io.vertx.redis.client.Response>
      Specified by:
      exceptionHandler in interface StreamBase
      Parameters:
      handler - the exception handler. Can be null.
      Returns:
      a reference to this, so the API can be used fluently
    • handler

      public RedisConnection handler(Consumer<io.vertx.redis.client.Response> handler)
      Set a data handler. As data is read, the handler will be called with the data.
      Specified by:
      handler in interface ReadStream<io.vertx.redis.client.Response>
      Returns:
      a reference to this, so the API can be used fluently
    • pause

      public RedisConnection pause()
      Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

      While it's paused, no data will be sent to the data handler.

      Specified by:
      pause in interface ReadStream<io.vertx.redis.client.Response>
      Returns:
      a reference to this, so the API can be used fluently
    • resume

      public RedisConnection resume()
      Resume reading, and sets the buffer in flowing mode.

      If the ReadStream has been paused, reading will recommence on it.

      Specified by:
      resume in interface ReadStream<io.vertx.redis.client.Response>
      Returns:
      a reference to this, so the API can be used fluently
    • fetch

      public RedisConnection fetch(long amount)
      Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.
      Specified by:
      fetch in interface ReadStream<io.vertx.redis.client.Response>
      Returns:
      a reference to this, so the API can be used fluently
    • endHandler

      public RedisConnection endHandler(Runnable endHandler)
      Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
      Specified by:
      endHandler in interface ReadStream<io.vertx.redis.client.Response>
      Returns:
      a reference to this, so the API can be used fluently
    • pendingQueueFull

      public boolean pendingQueueFull()
      Flag to notify if the pending message queue (commands in transit) is full.

      When the pending message queue is full and a new send command is issued it will result in a exception to be thrown. Checking this flag before sending can allow the application to wait before sending the next message.

      Returns:
      true is queue is full.
    • pipe

      public Pipe<io.vertx.redis.client.Response> pipe()
      Pause this stream and return a Pipe to transfer the elements of this stream to a destination WriteStream.

      The stream will be resumed when the pipe will be wired to a WriteStream.

      Specified by:
      pipe in interface ReadStream<io.vertx.redis.client.Response>
      Returns:
      a pipe
    • newInstance

      public static RedisConnection newInstance(io.vertx.redis.client.RedisConnection delegate)
      Creates a new instance of the RedisConnection.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toMulti

      @CheckReturnValue public io.smallrye.mutiny.Multi<io.vertx.redis.client.Response> toMulti()
    • toBlockingIterable

      public Iterable<io.vertx.redis.client.Response> toBlockingIterable()
    • toBlockingStream

      public Stream<io.vertx.redis.client.Response> toBlockingStream()