Record Class SpringCloudQueryControllerConfiguration
java.lang.Object
java.lang.Record
io.axoniq.framework.springcloud.query.SpringCloudQueryControllerConfiguration
- Record Components:
queryTimeout- how long a response stream may stay open before the container closes it. A query still being answered when it elapses is reported to the member that asked as a failed stream. Does not apply to a subscription query, which lasts as long as the subscriber wants it tokeepAliveInterval- how often an idle subscription is written to, so that neither the subscribing member nor the intermediaries between the two mistake a quiet subscription for a dead one. Must be comfortably below the window subscribing members give a subscription to say something
public record SpringCloudQueryControllerConfiguration(Duration queryTimeout, Duration keepAliveInterval)
extends Record
Configuration of the
SpringCloudQueryController.
Holds the settings that decide how long the streams the controller answers with may stay open, and how often an
idle subscription is written to. For a default configuration use the DEFAULT constant, and adjust it
through the fluent methods, each of which returns a new instance.
The Spring Boot autoconfiguration builds this from the axon.springcloud.query-timeout and
axon.springcloud.subscription-keep-alive-interval properties.
Example usage:
SpringCloudQueryControllerConfiguration configuration =
SpringCloudQueryControllerConfiguration.DEFAULT.queryTimeout(Duration.ofMinutes(1))
.keepAliveInterval(Duration.ofSeconds(10));
- Since:
- 5.4.0
- Author:
- Allard Buijze, Mateusz Nowak
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SpringCloudQueryControllerConfigurationA default instance of theSpringCloudQueryControllerConfiguration, setting thequeryTimeout()toDEFAULT_QUERY_TIMEOUTand thekeepAliveInterval()toDEFAULT_KEEP_ALIVE_INTERVAL.static final DurationHow often an idle subscription is written to when no other interval is configured.static final DurationHow long a response stream may stay open when no other timeout is configured. -
Constructor Summary
ConstructorsConstructorDescriptionSpringCloudQueryControllerConfiguration(Duration queryTimeout, Duration keepAliveInterval) Compact constructor validating that the givenqueryTimeoutandkeepAliveIntervalare notnull, and that thekeepAliveIntervalis positive. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thekeepAliveIntervalrecord component.keepAliveInterval(Duration keepAliveInterval) Sets how often an idle subscription is written to.Returns the value of thequeryTimeoutrecord component.queryTimeout(Duration queryTimeout) Sets how long a response stream may stay open before the container closes it.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_QUERY_TIMEOUT
How long a response stream may stay open when no other timeout is configured. -
DEFAULT_KEEP_ALIVE_INTERVAL
How often an idle subscription is written to when no other interval is configured.Comfortably inside the sixty seconds a load balancer, proxy or NAT table commonly gives an idle connection, so that several keep-alives pass before any of them would reclaim it.
-
DEFAULT
A default instance of theSpringCloudQueryControllerConfiguration, setting thequeryTimeout()toDEFAULT_QUERY_TIMEOUTand thekeepAliveInterval()toDEFAULT_KEEP_ALIVE_INTERVAL.
-
-
Constructor Details
-
SpringCloudQueryControllerConfiguration
Compact constructor validating that the givenqueryTimeoutandkeepAliveIntervalare notnull, and that thekeepAliveIntervalis positive.
-
-
Method Details
-
queryTimeout
Sets how long a response stream may stay open before the container closes it.Defaults to
DEFAULT_QUERY_TIMEOUT.- Parameters:
queryTimeout- how long a response stream may stay open before the container closes it- Returns:
- a new configuration instance, for fluent interfacing
-
keepAliveInterval
Sets how often an idle subscription is written to.Defaults to
DEFAULT_KEEP_ALIVE_INTERVAL.- Parameters:
keepAliveInterval- how often an idle subscription is written to, must be positive- Returns:
- a new configuration instance, for fluent interfacing
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
queryTimeout
Returns the value of thequeryTimeoutrecord component.- Returns:
- the value of the
queryTimeoutrecord component
-
keepAliveInterval
Returns the value of thekeepAliveIntervalrecord component.- Returns:
- the value of the
keepAliveIntervalrecord component
-