Class ServiceConfigProperties


public class ServiceConfigProperties extends ServerConfig
A POJO for configuring common properties of server components.
  • Field Details

    • DEFAULT_MAX_PAYLOAD_SIZE

      public static final int DEFAULT_MAX_PAYLOAD_SIZE
      The default maximum payload size for messages uploaded by devices.
      See Also:
    • DEFAULT_SEND_TIMEOUT_IN_MS

      public static final long DEFAULT_SEND_TIMEOUT_IN_MS
      The default send timeout value in milliseconds, which is to be used when sending a message on the vert.x event bus.
      See Also:
    • MIN_SEND_TIMEOUT_IN_MS

      public static final long MIN_SEND_TIMEOUT_IN_MS
      The minimum send timeout value in milliseconds is 500 ms and any value less than this minimum value is not accepted.
      See Also:
  • Constructor Details

    • ServiceConfigProperties

      public ServiceConfigProperties()
      Creates new properties using default values.
    • ServiceConfigProperties

      public ServiceConfigProperties(ServiceOptions options)
      Creates a new instance from existing options.
      Parameters:
      options - The options to copy.
      Throws:
      NullPointerException - if options are null.
  • Method Details

    • setMaxPayloadSize

      public final void setMaxPayloadSize(int bytes)
      Sets the maximum size of a message payload this server accepts from clients.

      The default value of this property is 2048 bytes.

      Parameters:
      bytes - The maximum number of bytes.
      Throws:
      IllegalArgumentException - if bytes is < 128.
    • getMaxPayloadSize

      public final int getMaxPayloadSize()
      Gets the maximum size of a message payload this server accepts from clients.

      The default value of this property is 2048 bytes.

      Returns:
      The maximum number of bytes.
    • isNetworkDebugLoggingEnabled

      public final boolean isNetworkDebugLoggingEnabled()
      Checks whether the server is configured to log TCP traffic.
      Returns:
      true if TCP traffic gets logged.
    • setNetworkDebugLoggingEnabled

      public final ServiceConfigProperties setNetworkDebugLoggingEnabled(boolean networkDebugLoggingEnabled)
      Sets whether the server should log TCP traffic.

      The default value of this property is false.

      Parameters:
      networkDebugLoggingEnabled - true if TCP traffic should be logged.
      Returns:
      This instance for setter chaining.
    • isWaitForDownstreamConnectionEnabled

      public final boolean isWaitForDownstreamConnectionEnabled()
      Checks whether the server waits for downstream connections to be established during startup.

      If this property is set to true then startup may take some time or even time out if the downstream container to connect to is not (yet) available.

      The default value of this property is false.

      Returns:
      true if the server will wait for downstream connections to be established during startup.
    • setWaitForDownstreamConnectionEnabled

      public final ServiceConfigProperties setWaitForDownstreamConnectionEnabled(boolean waitForConnection)
      Sets whether the server should wait for downstream connections to be established during startup.

      If this property is set to true then startup may take some time or even time out if the downstream container to connect to is not (yet) available.

      The default value of this property is false.

      Parameters:
      waitForConnection - true if the server should wait for downstream connections to be established during startup.
      Returns:
      This instance for setter chaining.
    • getReceiverLinkCredit

      public final int getReceiverLinkCredit()
      Gets the number of AMQP message credits this service flows to a client when the client opens a sender link to this service.

      The default value of this property is DEFAULT_RECEIVER_LINK_CREDITS.

      Returns:
      The number of credits.
    • setReceiverLinkCredit

      public final void setReceiverLinkCredit(int receiverLinkCredit)
      Sets the number of AMQP message credits this service flows to a client when the client opens a sender link to this service.

      The credits are replenished automatically with each message being processed successfully by this service.

      The default value of this property is DEFAULT_RECEIVER_LINK_CREDITS.

      Parameters:
      receiverLinkCredit - The number of credits.
      Throws:
      IllegalArgumentException - if the credit is <= 0.
    • getCorsAllowedOrigin

      public final String getCorsAllowedOrigin()
      Gets the allowed origin pattern for CORS handler.

      The allowed origin pattern for CORS is returned to clients via the Access-Control-Allow-Origin header. It can be used by Web Applications to make sure that requests go only to trusted backend entities.

      The default value is '*'.

      Returns:
      The allowed origin pattern for CORS handler.
    • setCorsAllowedOrigin

      public final void setCorsAllowedOrigin(String corsAllowedOrigin)
      Sets the allowed origin pattern for CORS handler.

      The allowed origin pattern for CORS is returned to clients via the Access-Control-Allow-Origin header. It can be used by Web Applications to make sure that requests go only to trusted backend entities.

      The default value is '*'.

      Parameters:
      corsAllowedOrigin - The allowed origin pattern for CORS handler.
      Throws:
      NullPointerException - if the allowed origin pattern is null.
    • getSendTimeOut

      public final long getSendTimeOut()
      Gets the send timeout value in milliseconds, which is to be used when sending a message on the vert.x event bus.

      The default value of this property is DEFAULT_SEND_TIMEOUT_IN_MS.

      Returns:
      The send timeout value in milliseconds.
    • setSendTimeOut

      public final void setSendTimeOut(long sendTimeOutInMs)
      Sets the send timeout value in milliseconds, which is to be used when sending a message on the vert.x event bus.

      The default value of this property is DEFAULT_SEND_TIMEOUT_IN_MS.

      Parameters:
      sendTimeOutInMs - The send timeout value in milliseconds.
      Throws:
      IllegalArgumentException - if the timeout value is less than MIN_SEND_TIMEOUT_IN_MS.
    • getDeviceIdPattern

      public final Pattern getDeviceIdPattern()
      Gets the pattern defining valid device identifiers.

      The default value of this property is "^[a-zA-Z0-9-_\\.:=]+$".

      Returns:
      The pattern.
    • setDeviceIdPattern

      public final void setDeviceIdPattern(String regex)
      Sets the regular expression defining valid device identifiers.

      The default value of this property is "^[a-zA-Z0-9-_\\.:=]+$"

      Parameters:
      regex - The regular expression.
      Throws:
      NullPointerException - if regex is null.
      PatternSyntaxException - if regex is not a valid regular expression.
    • getTenantIdPattern

      public final Pattern getTenantIdPattern()
      Gets the pattern defining valid tenant identifiers.

      The default value of this property is "^[a-zA-Z0-9-_\\.]+$".

      Returns:
      The pattern.
    • setTenantIdPattern

      public final void setTenantIdPattern(String regex)
      Sets the regular expression defining valid tenant identifiers.

      The default value of this property is RegistryManagementConstants.DEFAULT_REGEX_TENANT_ID

      Parameters:
      regex - The regular expression.
      Throws:
      NullPointerException - if regex is null.
      PatternSyntaxException - if regex is not a valid regular expression.
    • getEventLoopBlockedCheckTimeout

      public final long getEventLoopBlockedCheckTimeout()
      Gets the time to wait for completion after which a handler is considered to be blocking the vert.x event loop.

      Default value is 5000 milliseconds.

      Returns:
      The timeout value in milliseconds.
    • setEventLoopBlockedCheckTimeout

      public final void setEventLoopBlockedCheckTimeout(long eventLoopBlockedCheckTimeout)
      Sets the time to wait for completion after which a handler is to be considered to be blocking the vert.x event loop.

      Default value is 5000 milliseconds.

      Parameters:
      eventLoopBlockedCheckTimeout - The timeout value in milliseconds.