Class ServiceConfigProperties
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default maximum payload size for messages uploaded by devices.static final int
The default number of credits to flow to a client.static final long
The default send timeout value in milliseconds, which is to be used when sending a message on the vert.x event bus.static final long
The minimum send timeout value in milliseconds is 500 ms and any value less than this minimum value is not accepted.Fields inherited from class org.eclipse.hono.config.AbstractConfig
LOG, PREFIX_FILE
-
Constructor Summary
ConstructorDescriptionCreates new properties using default values.ServiceConfigProperties
(ServiceOptions options) Creates a new instance from existing options. -
Method Summary
Modifier and TypeMethodDescriptionfinal String
Gets the allowed origin pattern for CORS handler.final Pattern
Gets the pattern defining valid device identifiers.final long
Gets the time to wait for completion after which a handler is considered to be blocking the vert.x event loop.final int
Gets the maximum size of a message payload this server accepts from clients.final int
Gets the number of AMQP message credits this service flows to a client when the client opens a sender link to this service.final long
Gets the send timeout value in milliseconds, which is to be used when sending a message on the vert.x event bus.final Pattern
Gets the pattern defining valid tenant identifiers.final boolean
Checks whether the server is configured to log TCP traffic.final boolean
Checks whether the server waits for downstream connections to be established during startup.final void
setCorsAllowedOrigin
(String corsAllowedOrigin) Sets the allowed origin pattern for CORS handler.final void
setDeviceIdPattern
(String regex) Sets the regular expression defining valid device identifiers.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.final void
setMaxPayloadSize
(int bytes) Sets the maximum size of a message payload this server accepts from clients.final ServiceConfigProperties
setNetworkDebugLoggingEnabled
(boolean networkDebugLoggingEnabled) Sets whether the server should log TCP traffic.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.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.final void
setTenantIdPattern
(String regex) Sets the regular expression defining valid tenant identifiers.final ServiceConfigProperties
setWaitForDownstreamConnectionEnabled
(boolean waitForConnection) Sets whether the server should wait for downstream connections to be established during startup.Methods inherited from class org.eclipse.hono.config.ServerConfig
getBindAddress, getInsecurePort, getInsecurePort, getInsecurePortBindAddress, getPort, getPort, isInsecurePortEnabled, isNativeTlsRequired, isSecurePortEnabled, isSni, isSubstrateVm, setBindAddress, setInsecurePort, setInsecurePortBindAddress, setInsecurePortEnabled, setNativeTlsRequired, setPort, setSni
Methods inherited from class org.eclipse.hono.config.AbstractConfig
getCertPath, getKeyCertOptions, getKeyFormat, getKeyPath, getKeyStorePassword, getKeyStorePath, getPassword, getPathSeparator, getSecureProtocols, getSupportedCipherSuites, getTrustOptions, getTrustStoreFormat, getTrustStorePassword, getTrustStorePath, isValidPort, setCertPath, setKeyFormat, setKeyPath, setKeyStorePassword, setKeyStorePath, setPathSeparator, setSecureProtocols, setSupportedCipherSuites, setTrustStoreFormat, setTrustStorePassword, setTrustStorePath
-
Field Details
-
DEFAULT_MAX_PAYLOAD_SIZE
public static final int DEFAULT_MAX_PAYLOAD_SIZEThe default maximum payload size for messages uploaded by devices.- See Also:
-
DEFAULT_RECEIVER_LINK_CREDITS
public static final int DEFAULT_RECEIVER_LINK_CREDITSThe default number of credits to flow to a client.- See Also:
-
DEFAULT_SEND_TIMEOUT_IN_MS
public static final long DEFAULT_SEND_TIMEOUT_IN_MSThe 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_MSThe 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
Creates a new instance from existing options.- Parameters:
options
- The options to copy.- Throws:
NullPointerException
- if options arenull
.
-
-
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
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
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 isnull
.
-
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 thanMIN_SEND_TIMEOUT_IN_MS
.
-
getDeviceIdPattern
Gets the pattern defining valid device identifiers.The default value of this property is "^[a-zA-Z0-9-_\\.:=]+$".
- Returns:
- The pattern.
-
setDeviceIdPattern
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 isnull
.PatternSyntaxException
- if regex is not a valid regular expression.
-
getTenantIdPattern
Gets the pattern defining valid tenant identifiers.The default value of this property is "^[a-zA-Z0-9-_\\.]+$".
- Returns:
- The pattern.
-
setTenantIdPattern
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 isnull
.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.
-