Package io.vertx.grpc.client
Class GrpcClientOptions
- java.lang.Object
-
- io.vertx.grpc.client.GrpcClientOptions
-
public class GrpcClientOptions extends Object
Options configuring a gRPC client.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MAX_MESSAGE_SIZEThe default maximum message size in bytes accepted from a server =256KBstatic booleanDEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLYThe default value for automatic deadline schedule =false.static intDEFAULT_TIMEOUTThe default value of the timeout =0(no timeout).static TimeUnitDEFAULT_TIMEOUT_UNITThe default value of the timeout unit =TimeUnit.SECONDS.
-
Constructor Summary
Constructors Constructor Description GrpcClientOptions()Default constructor.GrpcClientOptions(GrpcClientOptions other)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetMaxMessageSize()booleangetScheduleDeadlineAutomatically()intgetTimeout()Return the default timeout set when sending gRPC requests, the initial value is0which does not send a timeout.TimeUnitgetTimeoutUnit()GrpcClientOptionssetMaxMessageSize(long maxMessageSize)Set the maximum message size in bytes accepted from a server, the maximum value is0xFFFFFFFFGrpcClientOptionssetScheduleDeadlineAutomatically(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.GrpcClientOptionssetTimeout(int timeout)Set the default timeout set when sending gRPC requests, this value should be set along withsetTimeoutUnit(TimeUnit).GrpcClientOptionssetTimeoutUnit(TimeUnit timeoutUnit)Set the unit of time of the default timeout value.
-
-
-
Field Detail
-
DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLY
public static final boolean DEFAULT_SCHEDULE_DEADLINE_AUTOMATICALLY
The default value for automatic deadline schedule =false.- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
The default value of the timeout =0(no timeout).- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT_UNIT
public static final TimeUnit DEFAULT_TIMEOUT_UNIT
The default value of the timeout unit =TimeUnit.SECONDS.
-
DEFAULT_MAX_MESSAGE_SIZE
public static final long DEFAULT_MAX_MESSAGE_SIZE
The default maximum message size in bytes accepted from a server =256KB- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GrpcClientOptions
public GrpcClientOptions()
Default constructor.
-
GrpcClientOptions
public GrpcClientOptions(GrpcClientOptions other)
Copy constructor.- Parameters:
other- the options to copy
-
-
Method Detail
-
getScheduleDeadlineAutomatically
public boolean getScheduleDeadlineAutomatically()
- Returns:
- whether the client will automatically schedule a deadline when a request carrying a timeout is sent.
-
setScheduleDeadlineAutomatically
public GrpcClientOptions setScheduleDeadlineAutomatically(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.
- 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
public GrpcClientOptions setTimeout(int timeout)
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
public TimeUnit getTimeoutUnit()
- Returns:
- the unit of time of the default timeout.
-
setTimeoutUnit
public GrpcClientOptions setTimeoutUnit(TimeUnit timeoutUnit)
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
public GrpcClientOptions setMaxMessageSize(long maxMessageSize)
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
-
-