io.vertx.grpc

## Interface GrpcBidiExchange<I,O>

- All Superinterfaces:
    GrpcReadStream<I>, GrpcWriteStream<O>, ReadStream<I>, StreamBase, WriteStream<O>

      public interface GrpcBidiExchange<I,O>
      extends GrpcReadStream<I>, GrpcWriteStream<O>

  Author:
    Paulo Lopes

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <I,O> GrpcBidiExchange<I,O>` | `create(GrpcReadStream<I> readStream, io.grpc.stub.StreamObserver<O> writeObserver)`
    `static <I,O> GrpcBidiExchange<I,O>` | `create(io.grpc.stub.StreamObserver<I> readObserver, io.grpc.stub.StreamObserver<O> writeObserver)`
    `GrpcBidiExchange<I,O>` | `drainHandler(Handler<Void> handler)` Set a drain handler on the stream.
    `GrpcBidiExchange<I,O>` | `endHandler(Handler<Void> handler)` Set an end handler.
    `GrpcBidiExchange<I,O>` | `exceptionHandler(Handler<Throwable> handler)` Set an exception handler on the read stream.
    `GrpcBidiExchange<I,O>` | `fail(Throwable t)` Send an error event into the stream.
    `GrpcBidiExchange<I,O>` | `fetch(long amount)` Fetch the specified `amount` of elements.
    `GrpcBidiExchange<I,O>` | `handler(Handler<I> handler)` Set a data handler.
    `GrpcBidiExchange<I,O>` | `pause()` Pause the `ReadSupport`.
    `io.grpc.stub.StreamObserver<I>` | `readObserver()` Should not be used by end user, it is a simple accessor the the underlying gRPC StreamObserver.
    `GrpcBidiExchange<I,O>` | `resume()` Resume reading.
    `GrpcBidiExchange<I,O>` | `setReadObserver(io.grpc.stub.StreamObserver<I> observer)`
    `GrpcBidiExchange<I,O>` | `setWriteQueueMaxSize(int maxSize)` Set the maximum size of the write queue to `maxSize`.
    `GrpcBidiExchange<I,O>` | `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.GrpcReadStream

      `create, create`

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

      `pipe, pipeTo, pipeTo`

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

      `create`

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

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

- - ### Method Detail

    - #### create

          static <I,O> GrpcBidiExchange<I,O> create(GrpcReadStream<I> readStream,
                                                    io.grpc.stub.StreamObserver<O> writeObserver)

    - #### create

          static <I,O> GrpcBidiExchange<I,O> create(io.grpc.stub.StreamObserver<I> readObserver,
                                                    io.grpc.stub.StreamObserver<O> writeObserver)

    - #### exceptionHandler

          GrpcBidiExchange<I,O> exceptionHandler(Handler<Throwable> handler)

      Description copied from interface: `GrpcReadStream`
      Set an exception handler on the read stream.
      Specified by:
        `exceptionHandler` in interface `GrpcReadStream<I>`
      Specified by:
        `exceptionHandler` in interface `GrpcWriteStream<O>`
      Specified by:
        `exceptionHandler` in interface `ReadStream<I>`
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Specified by:
        `exceptionHandler` in interface `WriteStream<O>`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### write

          GrpcBidiExchange<I,O> 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

          GrpcBidiExchange<I,O> 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

          GrpcBidiExchange<I,O> 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

          GrpcBidiExchange<I,O> 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

    - #### handler

          GrpcBidiExchange<I,O> handler(Handler<I> handler)

      Description copied from interface: `GrpcReadStream`
      Set a data handler. As data is read, the handler will be called with the data.
      Specified by:
        `handler` in interface `GrpcReadStream<I>`
      Specified by:
        `handler` in interface `ReadStream<I>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### pause

          GrpcBidiExchange<I,O> pause()

      Description copied from interface: `GrpcReadStream`
      Pause the `ReadSupport`. While it's paused, no data will be sent to the `dataHandler`
      Specified by:
        `pause` in interface `GrpcReadStream<I>`
      Specified by:
        `pause` in interface `ReadStream<I>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### resume

          GrpcBidiExchange<I,O> resume()

      Description copied from interface: `GrpcReadStream`
      Resume reading. If the `ReadSupport` has been paused, reading will recommence on it.
      Specified by:
        `resume` in interface `GrpcReadStream<I>`
      Specified by:
        `resume` in interface `ReadStream<I>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### fetch

          GrpcBidiExchange<I,O> fetch(long amount)

      Description copied from interface: `GrpcReadStream`
      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 `GrpcReadStream<I>`
      Specified by:
        `fetch` in interface `ReadStream<I>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### endHandler

          GrpcBidiExchange<I,O> endHandler(Handler<Void> handler)

      Description copied from interface: `GrpcReadStream`
      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 `GrpcReadStream<I>`
      Specified by:
        `endHandler` in interface `ReadStream<I>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### readObserver

          io.grpc.stub.StreamObserver<I> readObserver()

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

    - #### setReadObserver

          GrpcBidiExchange<I,O> setReadObserver(io.grpc.stub.StreamObserver<I> observer)

      Specified by:
        `setReadObserver` in interface `GrpcReadStream<I>`

    - #### 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 © 2019 Eclipse. All rights reserved.