Class GrpcClientOptions
java.lang.Object
io.vertx.grpc.client.GrpcClientOptions
Options configuring a gRPC client.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default maximum message size in bytes accepted from a server =256KBstatic final booleanThe default value for automatic deadline schedule =false.static final intThe default value of the timeout =0(no timeout).static final TimeUnitThe default value of the timeout unit =TimeUnit.SECONDS. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanintReturn the default timeout set when sending gRPC requests, the initial value is0which does not send a timeout.setMaxMessageSize(long maxMessageSize) Set the maximum message size in bytes accepted from a server, the maximum value is0xFFFFFFFFsetScheduleDeadlineAutomatically(boolean handleDeadlineAutomatically) Set whether a deadline is automatically scheduled when a request carrying a timeout (either set explicitly or through this options instance) is sent.setTimeout(int timeout) Set the default timeout set when sending gRPC requests, this value should be set along withsetTimeoutUnit(TimeUnit).setTimeoutUnit(TimeUnit timeoutUnit) Set the unit of time of the default timeout value.
-
Field Details
-
DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLY
public static final boolean DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLYThe default value for automatic deadline schedule =false.- See Also:
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTThe default value of the timeout =0(no timeout).- See Also:
-
DEFAULT_TIMEOUT_UNIT
The default value of the timeout unit =TimeUnit.SECONDS. -
DEFAULT_MAX_MESSAGE_SIZE
public static final long DEFAULT_MAX_MESSAGE_SIZEThe default maximum message size in bytes accepted from a server =256KB- See Also:
-
-
Constructor Details
-
GrpcClientOptions
public GrpcClientOptions()Default constructor. -
GrpcClientOptions
Copy constructor.- Parameters:
other- the options to copy
-
-
Method Details
-
getScheduleDeadlineAutomatically
public boolean getScheduleDeadlineAutomatically()- Returns:
- whether the client will automatically schedule a deadline when a request carrying a timeout is sent.
-
setScheduleDeadlineAutomatically
Set whether a deadline is automatically scheduled when a request carrying a timeout (either set explicitly or through this options instance) is sent.
- When the automatic deadline is set and a request carrying a timeout is sent, a deadline (timer) is created to cancel the request
when the response has not been timely received. The deadline can be obtained with
GrpcClientRequest.deadline(). - When the deadline is not set and a request carrying a timeout is sent, the timeout is sent to the server and it remains the responsibility of the caller to eventually cancel the request. Note: the server might cancel the request as well when its local deadline is met.
- Parameters:
handleDeadlineAutomatically- whether to automatically set- Returns:
- a reference to this, so the API can be used fluently
- When the automatic deadline is set and a request carrying a timeout is sent, a deadline (timer) is created to cancel the request
when the response has not been timely received. The deadline can be obtained with
-
getTimeout
public int getTimeout()Return the default timeout set when sending gRPC requests, the initial value is0which does not send a timeout.- Returns:
- the default timeout.
-
setTimeout
Set the default timeout set when sending gRPC requests, this value should be set along withsetTimeoutUnit(TimeUnit).- Parameters:
timeout- the timeout value- Returns:
- a reference to this, so the API can be used fluently
-
getTimeoutUnit
- Returns:
- the unit of time of the default timeout.
-
setTimeoutUnit
Set the unit of time of the default timeout value.- Parameters:
timeoutUnit- the unit of time- 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 client
-
setMaxMessageSize
Set the maximum message size in bytes accepted from a server, the maximum value is0xFFFFFFFF- Parameters:
maxMessageSize- the size- Returns:
- a reference to this, so the API can be used fluently
-