mqtt: implement Close (#905)
* mqtt: implement Close Signed-off-by: Long Dai <long0dai@foxmail.com> * feedback Signed-off-by: Long Dai <long0dai@foxmail.com> Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
This commit is contained in:
parent
92846ab691
commit
01ca433ad9
|
@ -311,3 +311,12 @@ func (m *MQTT) createClientOptions(uri *url.URL, clientID string) *mqtt.ClientOp
|
|||
|
||||
return opts
|
||||
}
|
||||
|
||||
func (m *MQTT) Close() error {
|
||||
if m.consumer != nil {
|
||||
m.consumer.Disconnect(1)
|
||||
}
|
||||
m.producer.Disconnect(1)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue