本文整理匯總了Golang中github.com/cgrates/cgrates/config.CGRConfig類的典型用法代碼示例。如果您正苦於以下問題:Golang CGRConfig類的具體用法?Golang CGRConfig怎麽用?Golang CGRConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CGRConfig類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: startResourceLimiterService
func startResourceLimiterService(internalRLSChan, internalCdrStatSChan chan rpcclient.RpcClientConnection, cfg *config.CGRConfig,
accountDb engine.AccountingStorage, server *utils.Server, exitChan chan bool) {
var statsConn *rpcclient.RpcClientPool
if len(cfg.ResourceLimiterCfg().CDRStatConns) != 0 { // Stats connection init
statsConn, err = engine.NewRPCPool(rpcclient.POOL_FIRST, cfg.ConnectAttempts, cfg.Reconnects, cfg.ConnectTimeout, cfg.ReplyTimeout,
cfg.ResourceLimiterCfg().CDRStatConns, internalCdrStatSChan, cfg.InternalTtl)
if err != nil {
utils.Logger.Crit(fmt.Sprintf("<RLs> Could not connect to StatS: %s", err.Error()))
exitChan <- true
return
}
}
rls, err := engine.NewResourceLimiterService(cfg, accountDb, statsConn)
if err != nil {
utils.Logger.Crit(fmt.Sprintf("<RLs> Could not init, error: %s", err.Error()))
exitChan <- true
return
}
utils.Logger.Info(fmt.Sprintf("Starting ResourceLimiter service"))
if err := rls.ListenAndServe(); err != nil {
utils.Logger.Crit(fmt.Sprintf("<RLs> Could not start, error: %s", err.Error()))
exitChan <- true
return
}
server.RpcRegisterName("RLsV1", rls)
internalRLSChan <- rls
}
示例2: NewDiameterAgent
func NewDiameterAgent(cgrCfg *config.CGRConfig, smg *rpcclient.RpcClient, pubsubs *rpcclient.RpcClient) (*DiameterAgent, error) {
da := &DiameterAgent{cgrCfg: cgrCfg, smg: smg, pubsubs: pubsubs}
dictsDir := cgrCfg.DiameterAgentCfg().DictionariesDir
if len(dictsDir) != 0 {
if err := loadDictionaries(dictsDir, "DiameterAgent"); err != nil {
return nil, err
}
}
return da, nil
}
示例3: NewDiameterAgent
func NewDiameterAgent(cgrCfg *config.CGRConfig, smg rpcclient.RpcClientConnection, pubsubs rpcclient.RpcClientConnection) (*DiameterAgent, error) {
da := &DiameterAgent{cgrCfg: cgrCfg, smg: smg, pubsubs: pubsubs, ccrQueue: make(chan *DiameterMessage, CCRQueueLen)}
dictsDir := cgrCfg.DiameterAgentCfg().DictionariesDir
if len(dictsDir) != 0 {
if err := loadDictionaries(dictsDir, "DiameterAgent"); err != nil {
return nil, err
}
}
go da.ccrServer()
return da, nil
}
示例4: NewDiameterAgent
func NewDiameterAgent(cgrCfg *config.CGRConfig, smg rpcclient.RpcClientConnection, pubsubs rpcclient.RpcClientConnection) (*DiameterAgent, error) {
da := &DiameterAgent{cgrCfg: cgrCfg, smg: smg, pubsubs: pubsubs, connMux: new(sync.Mutex)}
if reflect.ValueOf(da.pubsubs).IsNil() {
da.pubsubs = nil // Empty it so we can check it later
}
dictsDir := cgrCfg.DiameterAgentCfg().DictionariesDir
if len(dictsDir) != 0 {
if err := loadDictionaries(dictsDir, "DiameterAgent"); err != nil {
return nil, err
}
}
return da, nil
}