mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Use paho configuration API instead of setting it directly with struct initializer. (#5707)
This commit is contained in:
parent
58291acb8d
commit
2182c1a4f7
@ -92,16 +92,15 @@ func (target *MQTTTarget) Close() error {
|
|||||||
|
|
||||||
// NewMQTTTarget - creates new MQTT target.
|
// NewMQTTTarget - creates new MQTT target.
|
||||||
func NewMQTTTarget(id string, args MQTTArgs) (*MQTTTarget, error) {
|
func NewMQTTTarget(id string, args MQTTArgs) (*MQTTTarget, error) {
|
||||||
options := &mqtt.ClientOptions{
|
options := mqtt.NewClientOptions().
|
||||||
ClientID: args.ClientID,
|
SetClientID(args.ClientID).
|
||||||
CleanSession: true,
|
SetCleanSession(true).
|
||||||
Username: args.User,
|
SetUsername(args.User).
|
||||||
Password: args.Password,
|
SetPassword(args.Password).
|
||||||
MaxReconnectInterval: args.MaxReconnectInterval,
|
SetMaxReconnectInterval(args.MaxReconnectInterval).
|
||||||
KeepAlive: args.KeepAlive,
|
SetKeepAlive(args.KeepAlive).
|
||||||
TLSConfig: tls.Config{RootCAs: args.RootCAs},
|
SetTLSConfig(&tls.Config{RootCAs: args.RootCAs}).
|
||||||
}
|
AddBroker(args.Broker.String())
|
||||||
options.AddBroker(args.Broker.String())
|
|
||||||
|
|
||||||
client := mqtt.NewClient(options)
|
client := mqtt.NewClient(options)
|
||||||
token := client.Connect()
|
token := client.Connect()
|
||||||
|
Loading…
Reference in New Issue
Block a user