Class ResourceLimits

java.lang.Object
org.eclipse.hono.util.ResourceLimits

public class ResourceLimits extends Object
Resource limits definition.
  • Constructor Details

    • ResourceLimits

      public ResourceLimits()
  • Method Details

    • setMaxConnections

      public final ResourceLimits setMaxConnections(int maxConnections)
      Sets the maximum number of connected devices a tenant supports.
      Parameters:
      maxConnections - The maximum number of connections to set.
      Returns:
      A reference to this for fluent use.
      Throws:
      IllegalArgumentException - if the maximum connections is set to less than -1.
    • getMaxConnections

      public final int getMaxConnections()
      Gets the maximum number of connected devices a tenant supports.
      Returns:
      The maximum number of connections or TenantConstants.UNLIMITED_CONNECTIONS if not set.
    • getMaxTtl

      public final long getMaxTtl(String endpointName, QoS qos)
      Gets the maximum time-to-live to use for messages published by devices of a tenant to a given endpoint.
      Parameters:
      endpointName - The name of the endpoint.
      qos - The quality of service being used for the messages.
      Returns:
      The time-to-live in seconds.
      Throws:
      NullPointerException - if the endpoint name indicates a telemetry endpoint and qos is null.
      IllegalArgumentException - if endpoint name is unknown.
    • setMaxTtl

      public final ResourceLimits setMaxTtl(long maxTtl)
      Sets the maximum time-to-live to use for events published by devices of a tenant.
      Parameters:
      maxTtl - The time-to-live in seconds.
      Returns:
      A reference to this for fluent use.
      Throws:
      IllegalArgumentException - if the time-to-live is set to less than -1.
    • getMaxTtl

      public final long getMaxTtl()
      Gets the maximum time-to-live to use for events published by devices of a tenant.
      Returns:
      The time-to-live in seconds.
    • setMaxTtlTelemetryQoS0

      public final ResourceLimits setMaxTtlTelemetryQoS0(long maxTtl)
      Sets the maximum time-to-live to use for telemetry messages published by devices of a tenant with QoS 0.
      Parameters:
      maxTtl - The time-to-live in seconds.
      Returns:
      A reference to this for fluent use.
      Throws:
      IllegalArgumentException - if the time-to-live is set to less than -1.
    • getMaxTtlTelemetryQoS0

      public final long getMaxTtlTelemetryQoS0()
      Gets the maximum time-to-live to use for telemetry messages published by devices of a tenant with QoS 0.
      Returns:
      The time-to-live in seconds.
    • setMaxTtlTelemetryQoS1

      public final ResourceLimits setMaxTtlTelemetryQoS1(long maxTtl)
      Sets the maximum time-to-live to use for telemetry messages published by devices of a tenant with QoS 1.
      Parameters:
      maxTtl - The time-to-live in seconds.
      Returns:
      A reference to this for fluent use.
      Throws:
      IllegalArgumentException - if the time-to-live is set to less than -1.
    • getMaxTtlTelemetryQoS1

      public final long getMaxTtlTelemetryQoS1()
      Gets the maximum time-to-live to use for telemetry messages published by devices of a tenant with QoS 1.
      Returns:
      The time-to-live in seconds.
    • setMaxTtlCommandResponse

      public final ResourceLimits setMaxTtlCommandResponse(long maxTtl)
      Sets the maximum time-to-live to use for command responses published by devices of a tenant.
      Parameters:
      maxTtl - The time-to-live in seconds.
      Returns:
      A reference to this for fluent use.
      Throws:
      IllegalArgumentException - if the time-to-live is set to less than -1.
    • getMaxTtlCommandResponse

      public final long getMaxTtlCommandResponse()
      Gets the maximum time-to-live to use for command responses published by devices of a tenant.
      Returns:
      The time-to-live in seconds.
    • getDataVolume

      public final DataVolume getDataVolume()
      Gets the data volume properties which are required for the message limit verification.
      Returns:
      The data volume properties.
    • setDataVolume

      public final ResourceLimits setDataVolume(DataVolume dataVolume)
      Sets the data volume properties which are required for the message limit verification.
      Parameters:
      dataVolume - the data volume properties.
      Returns:
      a reference to this for fluent use.
    • getConnectionDuration

      public final ConnectionDuration getConnectionDuration()
      Gets the properties that are required for the connection duration verification.
      Returns:
      The connection duration properties.
    • setConnectionDuration

      public final ResourceLimits setConnectionDuration(ConnectionDuration connectionDuration)
      Sets the properties that are required for the connection duration verification.
      Parameters:
      connectionDuration - the connection duration properties.
      Returns:
      a reference to this for fluent use.
    • setExtensions

      public final ResourceLimits setExtensions(Map<String,Object> extensions)
      Sets the extension properties for this resource limits.
      Parameters:
      extensions - The extensions to set.
      Returns:
      a reference to this for fluent use.
    • getExtensions

      public final Map<String,Object> getExtensions()
      Gets the extension properties for this resource limits.
      Returns:
      The extensions.
    • putExtension

      public final ResourceLimits putExtension(String key, Object value)
      Adds an extension property to this resource limit.

      If an extension property already exists for the specified key, the old value is replaced by the specified value.

      Parameters:
      key - The key of the entry.
      value - The value of the entry.
      Returns:
      This instance, to allow chained invocations.
      Throws:
      NullPointerException - if any of the arguments is null.