Skip to content

Commit

Permalink
Allow to pass a SSLSocketFactory to MqttConnectionSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
tdroxler committed Mar 13, 2017
1 parent a7872e0 commit f91ef38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mqtt/src/main/scala/akka/stream/alpakka/mqtt/Mqtt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
package akka.stream.alpakka.mqtt

import javax.net.ssl.SSLSocketFactory

import akka.stream.stage._
import akka.util.ByteString
import org.eclipse.paho.client.mqttv3.{MqttMessage => PahoMqttMessage, _}
Expand Down Expand Up @@ -74,6 +76,7 @@ final case class MqttConnectionSettings(
clientId: String,
persistence: MqttClientPersistence,
auth: Option[(String, String)] = None,
socketFactory: Option[SSLSocketFactory] = None,
cleanSession: Boolean = true,
will: Option[Will] = None
) {
Expand Down Expand Up @@ -159,6 +162,9 @@ private[mqtt] trait MqttConnectorLogic { this: GraphStageLogic =>
connectOptions.setUserName(user)
connectOptions.setPassword(password.toCharArray)
}
connectionSettings.socketFactory.foreach { socketFactory =>
connectOptions.setSocketFactory(socketFactory)
}
connectionSettings.will.foreach { will =>
connectOptions.setWill(will.message.topic, will.message.payload.toArray, will.qos.byteValue.toInt, will.retained)
}
Expand Down

0 comments on commit f91ef38

Please sign in to comment.