Class ConnAck
java.lang.Object
org.mqtt4j.hato.ConnAck
The broker's successful connection acknowledgement, with the limits that the broker announced
for the connection. MQTT 3.1.1 brokers announce none, so a 3.1.1 connection reports the
values that MQTT 5.0 assumes when a limit is not announced: QoS 2, retained messages and
wildcard and shared subscriptions available, and the largest packet that MQTT allows.
-
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of the connection attempt that this acknowledgement established.booleaninthashCode()intReturns the largest packet, in bytes including the fixed header, that the broker accepts on this connection.Returns the highest QoS at which the broker accepts publications on this connection.static ConnAckof(boolean sessionPresent, long connectionAttempt) Describes a successful acknowledgement of connection attempt numberconnectionAttempt, and whether the broker resumed a session, from a broker that announced no limits.booleanReturns whether the broker accepts publications with the retain flag on this connection.booleanReturns whether the broker resumed an existing session.booleanReturns whether the broker accepts shared subscriptions.toString()booleanReturns whether the broker accepts subscriptions whose filters contain wildcards.withMaximumPacketSize(int maximumPacketSize) Returns a copy with a different largest packet that the broker accepts.withMaximumQos(Qos maximumQos) Returns a copy with a different highest QoS at which the broker accepts publications.withRetainAvailable(boolean retainAvailable) Returns a copy with a different answer to whether the broker accepts retained publications.withSharedSubscriptionAvailable(boolean sharedSubscriptionAvailable) Returns a copy with a different answer to whether the broker accepts shared subscriptions.withWildcardSubscriptionAvailable(boolean wildcardSubscriptionAvailable) Returns a copy with a different answer to whether the broker accepts wildcard subscriptions.
-
Method Details
-
of
Describes a successful acknowledgement of connection attempt numberconnectionAttempt, and whether the broker resumed a session, from a broker that announced no limits. Thewithmethods describe the limits that a broker announced.- Parameters:
sessionPresent- whether the broker resumed an existing sessionconnectionAttempt- the number of the connection attempt that this acknowledgement established- Returns:
the acknowledgement, with the values that MQTT 5.0 assumes for limits that are not announced- Throws:
IllegalArgumentException-if `connectionAttempt` is not positive
-
withMaximumQos
-
withRetainAvailable
Returns a copy with a different answer to whether the broker accepts retained publications.- Parameters:
retainAvailable- whether the broker accepts retained publications- Returns:
- a copy with a different answer to whether the broker accepts retained publications
-
withWildcardSubscriptionAvailable
Returns a copy with a different answer to whether the broker accepts wildcard subscriptions.- Parameters:
wildcardSubscriptionAvailable- whether the broker accepts wildcard subscriptions- Returns:
- a copy with a different answer to whether the broker accepts wildcard subscriptions
-
withMaximumPacketSize
Returns a copy with a different largest packet that the broker accepts.- Parameters:
maximumPacketSize- the largest packet, in bytes including the fixed header, that the broker accepts- Returns:
- a copy with a different largest packet that the broker accepts
- Throws:
IllegalArgumentException-if `maximumPacketSize` is not between 1 and 268435460
-
sessionPresent
public boolean sessionPresent()Returns whether the broker resumed an existing session.- Returns:
- whether the broker resumed an existing session
-
connectionAttempt
public long connectionAttempt()Returns the number of the connection attempt that this acknowledgement established. A client numbers its attempts consecutively from 1, whether the application'sMqttClient.connect()or an automatic reconnection started them.- Returns:
- the number of the connection attempt that this acknowledgement established
-
maximumQos
Returns the highest QoS at which the broker accepts publications on this connection.- Returns:
- the highest QoS at which the broker accepts publications on this connection
-
retainAvailable
public boolean retainAvailable()Returns whether the broker accepts publications with the retain flag on this connection.- Returns:
- whether the broker accepts publications with the retain flag on this connection
-
wildcardSubscriptionAvailable
public boolean wildcardSubscriptionAvailable()Returns whether the broker accepts subscriptions whose filters contain wildcards.- Returns:
- whether the broker accepts subscriptions whose filters contain wildcards
-
maximumPacketSize
public int maximumPacketSize()Returns the largest packet, in bytes including the fixed header, that the broker accepts on this connection.- Returns:
- the largest packet, in bytes including the fixed header, that the broker accepts on this connection
-
equals
-
hashCode
-
toString
-