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 to
keepAliveInterval - 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 Details

  • Constructor Details

    • SpringCloudQueryControllerConfiguration

      public SpringCloudQueryControllerConfiguration(Duration queryTimeout, Duration keepAliveInterval)
      Compact constructor validating that the given queryTimeout and keepAliveInterval are not null, and that the keepAliveInterval is positive.
  • Method Details

    • queryTimeout

      public SpringCloudQueryControllerConfiguration queryTimeout(Duration 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

      public SpringCloudQueryControllerConfiguration keepAliveInterval(Duration 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • queryTimeout

      public Duration queryTimeout()
      Returns the value of the queryTimeout record component.
      Returns:
      the value of the queryTimeout record component
    • keepAliveInterval

      public Duration keepAliveInterval()
      Returns the value of the keepAliveInterval record component.
      Returns:
      the value of the keepAliveInterval record component