Update STOMP disconnection

This commit is contained in:
Fred Boniface
2024-04-15 20:36:33 +01:00
parent ba8e4e4c72
commit 790d293bc4
4 changed files with 18 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ func dial(user, pass string) *stomp.Conn {
)
if err != nil {
log.Fatal("Unable to connect to STOMP Client: " + err.Error())
conn.MustDisconnect()
conn.Disconnect()
}
log.Info("Initialised STOMP Client")
@@ -42,6 +42,11 @@ func Disconnect(conn *stomp.Conn) {
return
}
log.Error("STOMP Disconnect failed, next connection attempt may fail")
}
err := Client.Disconnect()
if err != nil {
Client.MustDisconnect()
log.Warn("STOMP Disconnect failed, forced disconnection")
}
log.Info("STOMP Client disconnected")
// Register against the MQ Server and log each message for testing purposes
}