Class ClientConfigProperties

    • Field Detail

      • DEFAULT_CONNECT_TIMEOUT

        public static final int DEFAULT_CONNECT_TIMEOUT
        The default amount of time (milliseconds) to wait for an AMQP connection to be opened.
        See Also:
        Constant Field Values
      • DEFAULT_FLOW_LATENCY

        public static final long DEFAULT_FLOW_LATENCY
        The default amount of time (milliseconds) to wait for credits after link creation.
        See Also:
        Constant Field Values
      • DEFAULT_IDLE_TIMEOUT

        public static final int DEFAULT_IDLE_TIMEOUT
        The default amount of time (milliseconds) after which a connection will be closed when no frames have been received from the remote peer.
        See Also:
        Constant Field Values
      • DEFAULT_INITIAL_CREDITS

        public static final int DEFAULT_INITIAL_CREDITS
        The default number of credits issued by the receiver side of a link.
        See Also:
        Constant Field Values
      • DEFAULT_LINK_ESTABLISHMENT_TIMEOUT

        public static final long DEFAULT_LINK_ESTABLISHMENT_TIMEOUT
        The default amount of time (milliseconds) to wait for the remote peer's attach frame during link establishment.
        See Also:
        Constant Field Values
      • DEFAULT_RECONNECT_MIN_DELAY

        public static final int DEFAULT_RECONNECT_MIN_DELAY
        The default minimum amount of time (milliseconds) to wait before trying to re-establish an AMQP connection with the peer.
        See Also:
        Constant Field Values
      • DEFAULT_RECONNECT_MAX_DELAY

        public static final int DEFAULT_RECONNECT_MAX_DELAY
        The default maximum amount of time (milliseconds) to wait before trying to re-establish an AMQP connection with the peer.
        See Also:
        Constant Field Values
      • DEFAULT_RECONNECT_DELAY_INCREMENT

        public static final int DEFAULT_RECONNECT_DELAY_INCREMENT
        The default amount of time (milliseconds) that the delay before trying to re-establish an AMQP connection with the peer will be increased by with each successive attempt.
        See Also:
        Constant Field Values
      • DEFAULT_REQUEST_TIMEOUT

        public static final long DEFAULT_REQUEST_TIMEOUT
        The default amount of time (milliseconds) to wait for a response before a request times out.
        See Also:
        Constant Field Values
      • DEFAULT_SEND_MESSAGE_TIMEOUT

        public static final long DEFAULT_SEND_MESSAGE_TIMEOUT
        The default amount of time (milliseconds) to wait for a delivery update after a message was sent.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ClientConfigProperties

        public ClientConfigProperties()
        Creates new properties with default values.
      • ClientConfigProperties

        public ClientConfigProperties​(ClientConfigProperties otherProperties)
        Creates properties based on other properties.
        Parameters:
        otherProperties - The properties to copy.
    • Method Detail

      • getName

        public final String getName()
        Gets the name being indicated as part of the container-id in the client's AMQP Open frame.
        Returns:
        The name or null if no name has been set.
      • setName

        public final void setName​(String name)
        Sets the name to indicate as part of the container-id in the client's AMQP Open frame.
        Parameters:
        name - The name to set.
      • getAmqpHostname

        public final String getAmqpHostname()
        Gets the name being indicated as the hostname in the client's AMQP Open frame.
        Returns:
        The host name or null if no host name has been set.
      • setAmqpHostname

        public final void setAmqpHostname​(String amqpHostname)
        Sets the name to indicate as the hostname in the client's AMQP Open frame.
        Parameters:
        amqpHostname - The host name to set.
      • getFlowLatency

        public final long getFlowLatency()
        Gets the maximum amount of time that a client should wait for credits after sender link creation.

        The AMQP 1.0 protocol requires the receiver side of a link to explicitly send a flow frame containing credits granted to the sender after the link has been established.

        This property can be used to tune the time period to wait according to the network latency involved with the communication link between the client and the service.

        The default value of this property is DEFAULT_FLOW_LATENCY.

        Returns:
        The number of milliseconds to wait.
      • setFlowLatency

        public final void setFlowLatency​(long latency)
        Sets the maximum amount of time that a client should wait for credits after sender link creation.

        The AMQP 1.0 protocol requires the receiver side of a link to explicitly send a flow frame containing credits granted to the sender after the link has been established.

        This property can be used to tune the time period to wait according to the network latency involved with the communication link between the client and the service.

        The default value of this property is DEFAULT_FLOW_LATENCY.

        Parameters:
        latency - The number of milliseconds to wait.
        Throws:
        IllegalArgumentException - if latency is negative.
      • getLinkEstablishmentTimeout

        public final long getLinkEstablishmentTimeout()
        Gets the maximum amount of time that a client waits for the establishment of a link with a peer.

        The AMQP 1.0 protocol defines that a link is established once both peers have exchanged their attach frames. The value of this property defines how long the client should wait for the peer's attach frame before considering the attempt to establish the link failed.

        This property can be used to tune the time period to wait according to the network latency involved with the communication link between the client and the service.

        The default value of this property is DEFAULT_LINK_ESTABLISHMENT_TIMEOUT.

        Returns:
        The number of milliseconds to wait.
      • setLinkEstablishmentTimeout

        public final void setLinkEstablishmentTimeout​(long latency)
        Sets the maximum amount of time that a client should wait for the establishment of a link with a peer.

        The AMQP 1.0 protocol defines that a link is established once both peers have exchanged their attach frames. The value of this property defines how long the client should wait for the peer's attach frame before considering the attempt to establish the link failed.

        This property can be used to tune the time period to wait according to the network latency involved with the communication link between the client and the service.

        The default value of this property is DEFAULT_FLOW_LATENCY.

        Parameters:
        latency - The number of milliseconds to wait.
        Throws:
        IllegalArgumentException - if latency is negative.
      • getInitialCredits

        public final int getInitialCredits()
        Gets the number of initial credits, that will be given from a receiver to a sender at link creation.

        The default value of this property is DEFAULT_INITIAL_CREDITS.

        Returns:
        The number of initial credits.
      • setInitialCredits

        public final void setInitialCredits​(int initialCredits)
        Sets the number of initial credits, that will be given from a receiver to a sender at link creation.

        The default value of this property is DEFAULT_INITIAL_CREDITS.

        Parameters:
        initialCredits - The initial credits to set.
        Throws:
        IllegalArgumentException - if the number is negative.
      • getSendMessageTimeout

        public final long getSendMessageTimeout()
        Gets the maximum amount of time a client should wait for a delivery update after sending an event or command message. If no delivery update is received in that time, the future with the outcome of the send operation will be failed.

        The default value of this property is DEFAULT_SEND_MESSAGE_TIMEOUT.

        Returns:
        The maximum number of milliseconds to wait.
      • setSendMessageTimeout

        public final void setSendMessageTimeout​(long sendMessageTimeoutMillis)
        Sets the maximum amount of time a client should wait for a delivery update after sending an event or command message. If no delivery update is received in that time, the future with the outcome of the send operation will be failed.

        The default value of this property is DEFAULT_SEND_MESSAGE_TIMEOUT.

        Parameters:
        sendMessageTimeoutMillis - The maximum number of milliseconds to wait.
        Throws:
        IllegalArgumentException - if timeout is negative.
      • getRequestTimeout

        public final long getRequestTimeout()
        Gets the maximum amount of time a client should wait for a response to a request before the request is failed.

        The default value of this property is DEFAULT_REQUEST_TIMEOUT.

        Returns:
        The maximum number of milliseconds to wait.
      • setRequestTimeout

        public final void setRequestTimeout​(long requestTimeoutMillis)
        Sets the maximum amount of time a client should wait for a response to a request before the request is failed.

        The default value of this property is DEFAULT_REQUEST_TIMEOUT.

        Parameters:
        requestTimeoutMillis - The maximum number of milliseconds to wait.
        Throws:
        IllegalArgumentException - if request timeout is negative.
      • getReconnectAttempts

        public int getReconnectAttempts()
        Gets the number of attempts (in addition to the original connection attempt) that the client should make in order to establish an AMQP connection with the peer before giving up.

        The default value of this property is -1 which means that the client will try forever.

        Returns:
        The number of attempts.
      • setReconnectAttempts

        public void setReconnectAttempts​(int attempts)
        Sets the number of attempts (in addition to the original connection attempt) that the client should make in order to establish an AMQP connection with the peer before giving up.

        The default value of this property is -1 which means that the client will try forever.

        Parameters:
        attempts - The number of attempts to make.
        Throws:
        IllegalArgumentException - if attempts is < -1.
      • getReconnectMinDelay

        public long getReconnectMinDelay()
        Gets the minimum amount of time to wait before trying to re-establish an AMQP connection with the peer.

        The default value of this property is 0.

        Returns:
        The minimum delay in milliseconds.
      • setReconnectMinDelay

        public void setReconnectMinDelay​(long reconnectMinDelay)
        Sets the minimum amount of time to wait before trying to re-establish an AMQP connection with the peer.

        The default value of this property is 0.

        Parameters:
        reconnectMinDelay - The minimum delay in milliseconds.
        Throws:
        IllegalArgumentException - if reconnectMinDelay is < 0.
      • getReconnectMaxDelay

        public long getReconnectMaxDelay()
        Gets the maximum amount of time to wait before trying to re-establish an AMQP connection with the peer.

        The default value of this property is 7000ms.

        Returns:
        The maximum delay in milliseconds.
      • setReconnectMaxDelay

        public void setReconnectMaxDelay​(long reconnectMaxDelay)
        Sets the maximum amount of time to wait before trying to re-establish an AMQP connection with the peer.

        The default value of this property is 7000ms.

        Parameters:
        reconnectMaxDelay - The maximum delay in milliseconds.
        Throws:
        IllegalArgumentException - if reconnectMaxDelay is < 0.
      • getReconnectDelayIncrement

        public long getReconnectDelayIncrement()
        Gets the factor used in the exponential backoff algorithm for determining the delay before trying to re-establish an AMQP connection with the peer.

        The default value of this property is 100ms.

        Returns:
        The value to exponentially increase the delay by in milliseconds.
      • setReconnectDelayIncrement

        public void setReconnectDelayIncrement​(long reconnectDelayIncrement)
        Sets the factor used in the exponential backoff algorithm for determining the delay before trying to re-establish an AMQP connection with the peer.

        The default value of this property is 100ms.

        Parameters:
        reconnectDelayIncrement - The value to exponentially increase the delay by in milliseconds.
        Throws:
        IllegalArgumentException - if reconnectDelayIncrement is < 0.
      • getConnectTimeout

        public final int getConnectTimeout()
        Gets the maximum amount of time a client should wait for an AMQP connection with a peer to be opened.

        This includes the time for TCP/TLS connection establishment, SASL handshake and exchange of the AMQP open frame.

        The default value of this property is DEFAULT_CONNECT_TIMEOUT.

        Returns:
        The maximum number of milliseconds to wait.
      • setConnectTimeout

        public final void setConnectTimeout​(int connectTimeoutMillis)
        Sets the maximum amount of time a client should wait for an AMQP connection with a peer to be opened.

        This includes the time for TCP/TLS connection establishment, SASL handshake and exchange of the AMQP open frame.

        The default value of this property is DEFAULT_CONNECT_TIMEOUT.

        Parameters:
        connectTimeoutMillis - The maximum number of milliseconds to wait.
        Throws:
        IllegalArgumentException - if connect timeout is negative.
      • getHeartbeatInterval

        public final int getHeartbeatInterval()
        Gets the interval in milliseconds in which frames are sent to the remote peer to check that the connection is still alive.

        This value is set to be half of getIdleTimeout().

        Returns:
        The heartbeatInterval in milliseconds.
      • getIdleTimeout

        public final int getIdleTimeout()
        Gets the amount of time in milliseconds after which a connection will be closed when no frames have been received from the remote peer.

        This property is also used to configure a heartbeat mechanism, checking that the connection is still alive. The corresponding heartbeat interval will be set to idleTimeout/2 ms.

        The default value of this property is DEFAULT_IDLE_TIMEOUT.

        Returns:
        The idleTimeout in milliseconds.
      • setIdleTimeout

        public final void setIdleTimeout​(int idleTimeoutMillis)
        Sets the amount of time in milliseconds after which a connection will be closed when no frames have been received from the remote peer.

        This property is also used to configure a heartbeat mechanism, checking that the connection is still alive. The corresponding heartbeat interval will be set to idleTimeout/2 ms.

        The default value of this property is DEFAULT_IDLE_TIMEOUT.

        Parameters:
        idleTimeoutMillis - The idleTimeout in milliseconds.
        Throws:
        IllegalArgumentException - if idleTimeout is negative.
      • getAddressRewriteRule

        public final String getAddressRewriteRule()
        Gets the rewrite rule for downstream addresses. See AddressHelper.rewrite(String, ClientConfigProperties) for more information about syntax and behavior of this property.
        Returns:
        The rewrite rule to be applied to the address.
      • getAddressRewritePattern

        public final Pattern getAddressRewritePattern()
        Gets precompiled address rewrite pattern.
        Returns:
        The precompiled address rewrite pattern.
      • getAddressRewriteReplacement

        public final String getAddressRewriteReplacement()
        Gets address rewrite replacement.
        Returns:
        The address rewrite replacement.