Skip to content

Commit 01ca433

Browse files
daixiang0yaron2
andauthored
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>
1 parent 92846ab commit 01ca433

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bindings/mqtt/mqtt.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,12 @@ func (m *MQTT) createClientOptions(uri *url.URL, clientID string) *mqtt.ClientOp
311311

312312
return opts
313313
}
314+
315+
func (m *MQTT) Close() error {
316+
if m.consumer != nil {
317+
m.consumer.Disconnect(1)
318+
}
319+
m.producer.Disconnect(1)
320+
321+
return nil
322+
}

0 commit comments

Comments
 (0)