@@ -90,7 +90,7 @@ protected void releaseNativeHandle() {}
90
90
91
91
/**
92
92
* Create a new builder with mTLS file paths
93
- *
93
+ *
94
94
* @param certPath - Path to certificate, in PEM format
95
95
* @param privateKeyPath - Path to private key, in PEM format
96
96
*/
@@ -102,7 +102,7 @@ public static AwsIotMqttConnectionBuilder newMtlsBuilderFromPath(String certPath
102
102
103
103
/**
104
104
* Create a new builder with mTLS cert pair in memory
105
- *
105
+ *
106
106
* @param certificate - Certificate, in PEM format
107
107
* @param privateKey - Private key, in PEM format
108
108
*/
@@ -114,7 +114,7 @@ public static AwsIotMqttConnectionBuilder newMtlsBuilder(String certificate, Str
114
114
115
115
/**
116
116
* Create a new builder with mTLS cert pair in memory
117
- *
117
+ *
118
118
* @param certificate - Certificate, in PEM format
119
119
* @param privateKey - Private key, in PEM format
120
120
*/
@@ -137,7 +137,7 @@ public static AwsIotMqttConnectionBuilder newDefaultBuilder()
137
137
138
138
/**
139
139
* Overrides the default system trust store.
140
- *
140
+ *
141
141
* @param caDirPath - Only used on Unix-style systems where all trust anchors
142
142
* are stored in a directory (e.g. /etc/ssl/certs).
143
143
* @param caFilePath - Single file containing all trust CAs, in PEM format
@@ -150,7 +150,7 @@ public AwsIotMqttConnectionBuilder withCertificateAuthorityFromPath(String caDir
150
150
151
151
/**
152
152
* Overrides the default system trust store.
153
- *
153
+ *
154
154
* @param caRoot - Buffer containing all trust CAs, in PEM format
155
155
*/
156
156
public AwsIotMqttConnectionBuilder withCertificateAuthority (String caRoot ) {
@@ -161,7 +161,7 @@ public AwsIotMqttConnectionBuilder withCertificateAuthority(String caRoot) {
161
161
162
162
/**
163
163
* Configures the IoT endpoint for connections from this builder.
164
- *
164
+ *
165
165
* @param endpoint The IoT endpoint to connect to
166
166
*/
167
167
public AwsIotMqttConnectionBuilder withEndpoint (String endpoint ) {
@@ -172,7 +172,7 @@ public AwsIotMqttConnectionBuilder withEndpoint(String endpoint) {
172
172
/**
173
173
* Configures the port to connect to for connections from this builder. If not set, 443 will be used for
174
174
* a websocket connection or where ALPN support is available. Otherwise the default is 8883.
175
- *
175
+ *
176
176
* @param port The port to connect to on the IoT endpoint. Usually 8883 for
177
177
* MQTT, or 443 for websockets
178
178
*/
@@ -183,7 +183,7 @@ public AwsIotMqttConnectionBuilder withPort(short port) {
183
183
184
184
/**
185
185
* Configures the client id to use to connect to the IoT Core service.
186
- *
186
+ *
187
187
* @param clientId The client id for connections from this builder. Needs to be unique across
188
188
* all devices/clients.
189
189
*/
@@ -195,7 +195,7 @@ public AwsIotMqttConnectionBuilder withClientId(String clientId) {
195
195
/**
196
196
* Configures whether or not the service should try to resume prior
197
197
* subscriptions, if it has any
198
- *
198
+ *
199
199
* @param cleanSession true if the session should drop prior subscriptions when
200
200
* a connection from this builder is established, false to resume the session
201
201
*/
@@ -207,7 +207,7 @@ public AwsIotMqttConnectionBuilder withCleanSession(boolean cleanSession) {
207
207
/**
208
208
* Configures MQTT keep-alive via PING messages. Note that this is not TCP
209
209
* keepalive.
210
- *
210
+ *
211
211
* @param keepAliveMs How often in milliseconds to send an MQTT PING message to the
212
212
* service to keep connections alive
213
213
*/
@@ -230,7 +230,7 @@ public AwsIotMqttConnectionBuilder withPingTimeoutMs(int pingTimeoutMs) {
230
230
231
231
/**
232
232
* Configures the TCP socket connect timeout (in milliseconds)
233
- *
233
+ *
234
234
* @param timeoutMs TCP socket timeout
235
235
*/
236
236
public AwsIotMqttConnectionBuilder withTimeoutMs (int timeoutMs ) {
@@ -240,7 +240,7 @@ public AwsIotMqttConnectionBuilder withTimeoutMs(int timeoutMs) {
240
240
241
241
/**
242
242
* Configures the common settings for the socket to use for connections created by this builder
243
- *
243
+ *
244
244
* @param socketOptions The socket settings
245
245
*/
246
246
public AwsIotMqttConnectionBuilder withSocketOptions (SocketOptions socketOptions ) {
@@ -283,19 +283,24 @@ public AwsIotMqttConnectionBuilder withConnectionEventCallbacks(MqttClientConnec
283
283
* disconnects
284
284
*
285
285
* @param message The message to publish as the will. The message contains the
286
- * topic that the message will be published to on disconnect.
287
- * @param qos The {@link QualityOfService} of the will message
288
- * @param retain Whether or not the message should be retained by the mqtt broker to
289
- * be delivered to future subscribers
286
+ * topic that the message will be published to on disconnect,
287
+ * along with the {@link QualityOfService} that it will be
288
+ * published with and whether it will be retained when it is published.
290
289
*/
291
- public AwsIotMqttConnectionBuilder withWill (MqttMessage message , QualityOfService qos , boolean retain ) throws MqttException {
290
+ public AwsIotMqttConnectionBuilder withWill (MqttMessage message ) throws MqttException {
292
291
this .config .setWillMessage (message );
293
- this .config .setWillQos (qos );
294
- this .config .setWillRetain (retain );
295
292
296
293
return this ;
297
294
}
298
295
296
+ /**
297
+ * @deprecated Use alternate withWill(). QoS and retain are now set directly on the {@link MqttMessage}
298
+ */
299
+ @ Deprecated
300
+ public AwsIotMqttConnectionBuilder withWill (MqttMessage message , QualityOfService qos , boolean retain ) throws MqttException {
301
+ return withWill (new MqttMessage (message .getTopic (), message .getPayload (), qos , retain ));
302
+ }
303
+
299
304
/**
300
305
* Configures the client bootstrap to use for connections created by this builder
301
306
*
0 commit comments