io.vertx.grpc

## Interface GrpcUniExchange<O,I>

- All Superinterfaces:
    GrpcWriteStream<O>, StreamBase, WriteStream<O>

      public interface GrpcUniExchange<O,I>
      extends GrpcWriteStream<O>

  Author:
    Paulo Lopes

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <O,I> GrpcUniExchange<O,I>` | `create(GrpcReadStream<I> read, io.grpc.stub.StreamObserver<O> write)`
    `GrpcUniExchange<O,I>` | `drainHandler(Handler<Void> handler)` Set a drain handler on the stream.
    `GrpcUniExchange<O,I>` | `fail(Throwable t)` Send an error event into the stream.
    `GrpcUniExchange<O,I>` | `handler(Handler<AsyncResult<I>> handler)`
    `GrpcUniExchange<O,I>` | `setWriteQueueMaxSize(int maxSize)` Set the maximum size of the write queue to `maxSize`.
    `GrpcUniExchange<O,I>` | `write(O data)` Write some data to the stream.
    `io.grpc.stub.StreamObserver<O>` | `writeObserver()` Should not be used by end user, it is a simple accessor the the underlying gRPC StreamObserver.

    - ### Methods inherited from interface io.vertx.grpc.GrpcWriteStream

      `create, exceptionHandler`

    - ### Methods inherited from interface io.vertx.core.streams.WriteStream

      `end, end, end, end, write, writeQueueFull`

- - ### Method Detail

    - #### create

          static <O,I> GrpcUniExchange<O,I> create(GrpcReadStream<I> read,
                                                   io.grpc.stub.StreamObserver<O> write)

    - #### handler

          GrpcUniExchange<O,I> handler(Handler<AsyncResult<I>> handler)

    - #### write

          GrpcUniExchange<O,I> write(O data)

      Description copied from interface: `GrpcWriteStream`
      Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the `WriteStream.writeQueueFull()` method before writing. This is done automatically if using a `Pump`.
      Specified by:
        `write` in interface `GrpcWriteStream<O>`
      Specified by:
        `write` in interface `WriteStream<O>`
      Parameters:
        `data` - the data to write
      Returns:
        a reference to this, so the API can be used fluently

    - #### setWriteQueueMaxSize

          GrpcUniExchange<O,I> setWriteQueueMaxSize(int maxSize)

      Description copied from interface: `GrpcWriteStream`
      Set the maximum size of the write queue to `maxSize`. You will still be able to write to the stream even if there is more than `maxSize` items in the write queue. This is used as an indicator by classes such as `Pump` to provide flow control.

      The value is defined by the implementation of the stream, e.g in bytes for a `NetSocket`, the number of `Message` for a `MessageProducer`, etc...
      Specified by:
        `setWriteQueueMaxSize` in interface `GrpcWriteStream<O>`
      Specified by:
        `setWriteQueueMaxSize` in interface `WriteStream<O>`
      Parameters:
        `maxSize` - the max size of the write stream
      Returns:
        a reference to this, so the API can be used fluently

    - #### drainHandler

          GrpcUniExchange<O,I> drainHandler(Handler<Void> handler)

      Description copied from interface: `GrpcWriteStream`
      Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See `Pump` for an example of this being used.

      The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to `maxSize / 2`.
      Specified by:
        `drainHandler` in interface `GrpcWriteStream<O>`
      Specified by:
        `drainHandler` in interface `WriteStream<O>`
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### fail

          GrpcUniExchange<O,I> fail(Throwable t)

      Description copied from interface: `GrpcWriteStream`
      Send an error event into the stream.
      Specified by:
        `fail` in interface `GrpcWriteStream<O>`
      Parameters:
        `t` - any error
      Returns:
        a reference to this, so the API can be used fluently

    - #### writeObserver

          io.grpc.stub.StreamObserver<O> writeObserver()

      Description copied from interface: `GrpcWriteStream`
      Should not be used by end user, it is a simple accessor the the underlying gRPC StreamObserver.
      Specified by:
        `writeObserver` in interface `GrpcWriteStream<O>`
      Returns:
        the underlying stream observer.

Copyright © 2020 Eclipse. All rights reserved.