2018-08-13 08:20:49 +00:00
|
|
|
package msgqueue
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
MessageQueues []MessageQueue
|
|
|
|
|
|
|
|
Queue MessageQueue
|
|
|
|
)
|
|
|
|
|
2018-08-19 22:17:55 +00:00
|
|
|
func LoadConfiguration(config *viper.Viper) {
|
2018-08-13 08:20:49 +00:00
|
|
|
|
2018-08-23 06:54:00 +00:00
|
|
|
if config == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-08-13 08:20:49 +00:00
|
|
|
for _, store := range MessageQueues {
|
2018-08-19 22:17:55 +00:00
|
|
|
if config.GetBool(store.GetName() + ".enabled") {
|
|
|
|
viperSub := config.Sub(store.GetName())
|
2018-08-13 08:20:49 +00:00
|
|
|
if err := store.Initialize(viperSub); err != nil {
|
|
|
|
glog.Fatalf("Failed to initialize store for %s: %+v",
|
|
|
|
store.GetName(), err)
|
|
|
|
}
|
|
|
|
Queue = store
|
2018-08-19 22:17:55 +00:00
|
|
|
glog.V(0).Infof("Configure message queue for %s", store.GetName())
|
2018-08-13 08:20:49 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|