Persist offline mqtt events in the queueDir and replay (#7037)

This commit is contained in:
Praveen raj Mani
2019-01-14 12:39:00 +05:30
committed by Harshavardhana
parent 8757c963ba
commit 6571641735
27 changed files with 1507 additions and 265 deletions
+19 -2
View File
@@ -16,6 +16,7 @@ package mqtt
import (
"crypto/tls"
"net/http"
"net/url"
"time"
)
@@ -25,6 +26,7 @@ type ClientOptionsReader struct {
options *ClientOptions
}
//Servers returns a slice of the servers defined in the clientoptions
func (r *ClientOptionsReader) Servers() []*url.URL {
s := make([]*url.URL, len(r.options.Servers))
@@ -36,21 +38,31 @@ func (r *ClientOptionsReader) Servers() []*url.URL {
return s
}
//ResumeSubs returns true if resuming stored (un)sub is enabled
func (r *ClientOptionsReader) ResumeSubs() bool {
s := r.options.ResumeSubs
return s
}
//ClientID returns the set client id
func (r *ClientOptionsReader) ClientID() string {
s := r.options.ClientID
return s
}
//Username returns the set username
func (r *ClientOptionsReader) Username() string {
s := r.options.Username
return s
}
//Password returns the set password
func (r *ClientOptionsReader) Password() string {
s := r.options.Password
return s
}
//CleanSession returns whether Cleansession is set
func (r *ClientOptionsReader) CleanSession() bool {
s := r.options.CleanSession
return s
@@ -91,13 +103,13 @@ func (r *ClientOptionsReader) ProtocolVersion() uint {
return s
}
func (r *ClientOptionsReader) TLSConfig() tls.Config {
func (r *ClientOptionsReader) TLSConfig() *tls.Config {
s := r.options.TLSConfig
return s
}
func (r *ClientOptionsReader) KeepAlive() time.Duration {
s := r.options.KeepAlive
s := time.Duration(r.options.KeepAlive * int64(time.Second))
return s
}
@@ -130,3 +142,8 @@ func (r *ClientOptionsReader) MessageChannelDepth() uint {
s := r.options.MessageChannelDepth
return s
}
func (r *ClientOptionsReader) HTTPHeaders() http.Header {
h := r.options.HTTPHeaders
return h
}