Package io.vertx.grpc.server

## Class GrpcServerOptions

- java.lang.Object
- - io.vertx.grpc.server.GrpcServerOptions

-     @Unstable
      public class GrpcServerOptions
      extends Object

  Configuration for a `GrpcServer`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static boolean` | `DEFAULT_GRPC_WEB_ENABLED` | Whether the gRPC-Web protocol should be enabled, by default = `true`.
    `static long` | `DEFAULT_MAX_MESSAGE_SIZE` | The default maximum message size in bytes accepted from a client = `256KB`
    `static boolean` | `DEFAULT_PROPAGATE_DEADLINE` | Whether the server propagates a deadline, by default = `false`
    `static boolean` | `DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLY` | Whether the server schedule deadline automatically when a request carrying a timeout is received, by default = `false`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GrpcServerOptions()` | Default options.
    `GrpcServerOptions​(JsonObject json)` | Creates options from JSON.
    `GrpcServerOptions​(GrpcServerOptions other)` | Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `getDeadlinePropagation()` |
    `long` | `getMaxMessageSize()` |
    `boolean` | `getScheduleDeadlineAutomatically()` |
    `boolean` | `isGrpcWebEnabled()` |
    `GrpcServerOptions` | `setDeadlinePropagation​(boolean deadlinePropagation)` | Set whether the server propagate deadlines to `io.vertx.grpc.client.GrpcClientRequest`.
    `GrpcServerOptions` | `setGrpcWebEnabled​(boolean grpcWebEnabled)` | Whether the gRPC-Web protocol should be enabled.
    `GrpcServerOptions` | `setMaxMessageSize​(long maxMessageSize)` | Set the maximum message size in bytes accepted from a client, the maximum value is `0xFFFFFFFF`
    `GrpcServerOptions` | `setScheduleDeadlineAutomatically​(boolean scheduleDeadlineAutomatically)` | Set whether a deadline is automatically scheduled when a request carrying a timeout is received.
    `JsonObject` | `toJson()` |
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_GRPC_WEB_ENABLED

          public static final boolean DEFAULT_GRPC_WEB_ENABLED

      Whether the gRPC-Web protocol should be enabled, by default = `true`.
      See Also:
        Constant Field Values

    - #### DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLY

          public static final boolean DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLY

      Whether the server schedule deadline automatically when a request carrying a timeout is received, by default = `false`
      See Also:
        Constant Field Values

    - #### DEFAULT_PROPAGATE_DEADLINE

          public static final boolean DEFAULT_PROPAGATE_DEADLINE

      Whether the server propagates a deadline, by default = `false`
      See Also:
        Constant Field Values

    - #### DEFAULT_MAX_MESSAGE_SIZE

          public static final long DEFAULT_MAX_MESSAGE_SIZE

      The default maximum message size in bytes accepted from a client = `256KB`
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GrpcServerOptions

          public GrpcServerOptions()

      Default options.

    - #### GrpcServerOptions

          public GrpcServerOptions​(GrpcServerOptions other)

      Copy constructor.

    - #### GrpcServerOptions

          public GrpcServerOptions​(JsonObject json)

      Creates options from JSON.

  - ### Method Detail

    - #### isGrpcWebEnabled

          public boolean isGrpcWebEnabled()

      Returns:
        `true` if the gRPC-Web protocol should be enabled, `false` otherwise

    - #### setGrpcWebEnabled

          public GrpcServerOptions setGrpcWebEnabled​(boolean grpcWebEnabled)

      Whether the gRPC-Web protocol should be enabled. Defaults to `true`.
      Parameters:
        `grpcWebEnabled` - `true` if the gRPC-Web protocol should be enabled, `false` otherwise
      Returns:
        a reference to this, so the API can be used fluently

    - #### getScheduleDeadlineAutomatically

          public boolean getScheduleDeadlineAutomatically()

      Returns:
        whether the server will automatically schedule a deadline when a request carrying a timeout is received.

    - #### setScheduleDeadlineAutomatically

          public GrpcServerOptions setScheduleDeadlineAutomatically​(boolean scheduleDeadlineAutomatically)

      Set whether a deadline is automatically scheduled when a request carrying a timeout is received.

      - When a deadline is automatically scheduled and a request carrying a timeout is received, a deadline (timer) will be created to cancel the request when the response has not been timely sent. The deadline can be obtained with `GrpcServerRequest.deadline()`.
      - When the deadline is not set and a request carrying a timeout is received, the timeout is available with `GrpcServerRequest.timeout()` and it is the responsibility of the service to eventually cancel the request. Note: the client might cancel the request as well when its local deadline is met.
      Parameters:
        `scheduleDeadlineAutomatically` - whether to schedule a deadline automatically
      Returns:
        a reference to this, so the API can be used fluently

    - #### getDeadlinePropagation

          public boolean getDeadlinePropagation()

      Returns:
        whether the server propagate deadlines to `io.vertx.grpc.client.GrpcClientRequest`.

    - #### setDeadlinePropagation

          public GrpcServerOptions setDeadlinePropagation​(boolean deadlinePropagation)

      Set whether the server propagate deadlines to `io.vertx.grpc.client.GrpcClientRequest`.
      Parameters:
        `deadlinePropagation` - the propagation setting
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxMessageSize

          public long getMaxMessageSize()

      Returns:
        the maximum message size in bytes accepted by the server

    - #### setMaxMessageSize

          public GrpcServerOptions setMaxMessageSize​(long maxMessageSize)

      Set the maximum message size in bytes accepted from a client, the maximum value is `0xFFFFFFFF`
      Parameters:
        `maxMessageSize` - the size
      Returns:
        a reference to this, so the API can be used fluently

    - #### toJson

          public JsonObject toJson()

      Returns:
        a JSON representation of options

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`