Record Class GrpcCircuitBreakerConfiguration
java.lang.Object
java.lang.Record
io.micronaut.grpc.client.circuitbreaker.GrpcCircuitBreakerConfiguration
- Record Components:
channelName- The channel nameenabled- Whether the circuit breaker is enabled for the channelfailureThreshold- The number of consecutive failed calls that opens the circuitresetTimeout- How long the circuit stays open before a trial call is let throughfailureStatusCodes- The status codes that count as failures
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set<io.grpc.Status.Code> The status codes that count as failures by default: those that indicate the server is unreachable or overloaded, rather than an application error.static final intThe default number of consecutive failures that opens the circuit.static final DurationThe default time the circuit stays open.static final StringThe property suffix under a channel's prefix. -
Constructor Summary
ConstructorsConstructorDescriptionGrpcCircuitBreakerConfiguration(String channelName, boolean enabled, int failureThreshold, Duration resetTimeout, Set<io.grpc.Status.Code> failureStatusCodes) Validates the configuration. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thechannelNamerecord component.booleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.Set<io.grpc.Status.Code> Returns the value of thefailureStatusCodesrecord component.intReturns the value of thefailureThresholdrecord component.final inthashCode()Returns a hash code value for this object.Reads the circuit breaker settings of a channel from the environment.Returns the value of theresetTimeoutrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
PREFIX
-
DEFAULT_FAILURE_THRESHOLD
public static final int DEFAULT_FAILURE_THRESHOLDThe default number of consecutive failures that opens the circuit.- See Also:
-
DEFAULT_RESET_TIMEOUT
The default time the circuit stays open. -
DEFAULT_FAILURE_STATUS_CODES
The status codes that count as failures by default: those that indicate the server is unreachable or overloaded, rather than an application error.
-
-
Constructor Details
-
GrpcCircuitBreakerConfiguration
-
-
Method Details
-
of
public static GrpcCircuitBreakerConfiguration of(io.micronaut.context.env.Environment environment, String channelName) Reads the circuit breaker settings of a channel from the environment.- Parameters:
environment- The environmentchannelName- The channel name- Returns:
- The configuration
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
channelName
Returns the value of thechannelNamerecord component.- Returns:
- the value of the
channelNamerecord component
-
enabled
-
failureThreshold
public int failureThreshold()Returns the value of thefailureThresholdrecord component.- Returns:
- the value of the
failureThresholdrecord component
-
resetTimeout
Returns the value of theresetTimeoutrecord component.- Returns:
- the value of the
resetTimeoutrecord component
-
failureStatusCodes
Returns the value of thefailureStatusCodesrecord component.- Returns:
- the value of the
failureStatusCodesrecord component
-