diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index f3853fe8c..0a3a16963 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -489,10 +489,11 @@ func main() { internalCacheSChan := make(chan rpcclient.ClientConnector, 1) internalGuardianSChan := make(chan rpcclient.ClientConnector, 1) - internalCDRServerChan := make(chan rpcclient.ClientConnector, 1) // needed to avod cyclic dependency - internalAttributeSChan := make(chan rpcclient.ClientConnector, 1) // needed to avod cyclic dependency - internalDispatcherSChan := make(chan rpcclient.ClientConnector, 1) // needed to avod cyclic dependency - internalSessionSChan := make(chan rpcclient.ClientConnector, 1) // needed to avod cyclic dependency + internalCDRServerChan := make(chan rpcclient.RpcClientConnection, 1) // needed to avod cyclic dependency + internalAttributeSChan := make(chan rpcclient.RpcClientConnection, 1) // needed to avod cyclic dependency + internalDispatcherSChan := make(chan rpcclient.RpcClientConnection, 1) // needed to avod cyclic dependency + internalSessionSChan := make(chan rpcclient.RpcClientConnection, 1) // needed to avod cyclic dependency + internalChargerSChan := make(chan rpcclient.RpcClientConnection, 1) // needed to avod cyclic dependency // init CacheS cacheS := initCacheS(internalCacheSChan, server, dmService.GetDM(), exitChan) @@ -505,11 +506,34 @@ func main() { // Start ServiceManager srvManager := servmanager.NewServiceManager(cfg, exitChan) + connManager := services.NewConnManagerService(cfg, map[string]chan rpcclient.RpcClientConnection{ + //utils.AnalyzerSv1: anz.GetIntenternalChan(), + //utils.ApierV1: rals.GetAPIv1().GetIntenternalChan(), + //utils.ApierV2: rals.GetAPIv2().GetIntenternalChan(), + utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): internalAttributeSChan, + utils.CacheSv1: internalCacheSChan, + //utils.CDRsV1: cdrS.GetIntenternalChan(), + //utils.CDRsV2: cdrS.GetIntenternalChan(), + utils.ConcatenatedKey(utils.MetaInternal, utils.MetaChargers): internalChargerSChan, + utils.GuardianSv1: internalGuardianSChan, + //utils.LoaderSv1: ldrs.GetIntenternalChan(), + //utils.ResourceSv1: reS.GetIntenternalChan(), + //utils.Responder: rals.GetResponder().GetIntenternalChan(), + //utils.SchedulerSv1: schS.GetIntenternalChan(), + utils.ConcatenatedKey(utils.MetaInternal, utils.MetaSessionS): internalSessionSChan, + //utils.StatSv1: stS.GetIntenternalChan(), + //utils.SupplierSv1: supS.GetIntenternalChan(), + //utils.ThresholdSv1: tS.GetIntenternalChan(), + utils.ServiceManagerV1: internalServeManagerChan, + utils.ConfigSv1: internalConfigChan, + utils.CoreSv1: internalCoreSv1Chan, + //utils.RALsV1: rals.GetIntenternalChan(), + }) attrS := services.NewAttributeService(cfg, dmService, cacheS, filterSChan, server, internalAttributeSChan) dspS := services.NewDispatcherService(cfg, dmService, cacheS, filterSChan, server, internalAttributeSChan, internalDispatcherSChan) chrS := services.NewChargerService(cfg, dmService, cacheS, filterSChan, server, - attrS.GetIntenternalChan(), dspS.GetIntenternalChan()) + internalChargerSChan, connManager.GetConnMgr()) tS := services.NewThresholdService(cfg, dmService, cacheS, filterSChan, server) stS := services.NewStatService(cfg, dmService, cacheS, filterSChan, server, tS.GetIntenternalChan(), dspS.GetIntenternalChan()) @@ -535,29 +559,6 @@ func main() { ldrs := services.NewLoaderService(cfg, dmService, filterSChan, server, internalCacheSChan, dspS.GetIntenternalChan(), exitChan) anz := services.NewAnalyzerService(cfg, server, exitChan) - connManager := services.NewConnManagerService(cfg, map[string]chan rpcclient.ClientConnector{ - utils.AnalyzerSv1: anz.GetIntenternalChan(), - utils.ApierV1: rals.GetAPIv1().GetIntenternalChan(), - utils.ApierV2: rals.GetAPIv2().GetIntenternalChan(), - utils.AttributeSv1: internalAttributeSChan, - utils.CacheSv1: internalCacheSChan, - utils.CDRsV1: cdrS.GetIntenternalChan(), - utils.CDRsV2: cdrS.GetIntenternalChan(), - utils.ChargerSv1: chrS.GetIntenternalChan(), - utils.GuardianSv1: internalGuardianSChan, - utils.LoaderSv1: ldrs.GetIntenternalChan(), - utils.ResourceSv1: reS.GetIntenternalChan(), - utils.Responder: rals.GetResponder().GetIntenternalChan(), - utils.SchedulerSv1: schS.GetIntenternalChan(), - utils.ConcatenatedKey(utils.MetaInternal, utils.MetaSessionS): internalSessionSChan, - utils.StatSv1: stS.GetIntenternalChan(), - utils.SupplierSv1: supS.GetIntenternalChan(), - utils.ThresholdSv1: tS.GetIntenternalChan(), - utils.ServiceManagerV1: internalServeManagerChan, - utils.ConfigSv1: internalConfigChan, - utils.CoreSv1: internalCoreSv1Chan, - utils.RALsV1: rals.GetIntenternalChan(), - }) srvManager.AddServices(connManager, attrS, chrS, tS, stS, reS, supS, schS, rals, rals.GetResponder(), rals.GetAPIv1(), rals.GetAPIv2(), cdrS, smg, services.NewEventReaderService(cfg, filterSChan, exitChan, connManager.GetConnMgr()), diff --git a/config/chargerscfg.go b/config/chargerscfg.go index c83be0447..3bee6e975 100644 --- a/config/chargerscfg.go +++ b/config/chargerscfg.go @@ -18,11 +18,13 @@ along with this program. If not, see package config +import "github.com/cgrates/cgrates/utils" + // SupplierSCfg is the configuration of supplier service type ChargerSCfg struct { Enabled bool IndexedSelects bool - AttributeSConns []*RemoteHost + AttributeSConns []string StringIndexedFields *[]string PrefixIndexedFields *[]string } @@ -38,10 +40,14 @@ func (cS *ChargerSCfg) loadFromJsonCfg(jsnCfg *ChargerSJsonCfg) (err error) { cS.IndexedSelects = *jsnCfg.Indexed_selects } if jsnCfg.Attributes_conns != nil { - cS.AttributeSConns = make([]*RemoteHost, len(*jsnCfg.Attributes_conns)) - for idx, jsnHaCfg := range *jsnCfg.Attributes_conns { - cS.AttributeSConns[idx] = NewDfltRemoteHost() - cS.AttributeSConns[idx].loadFromJsonCfg(jsnHaCfg) + cS.AttributeSConns = make([]string, len(*jsnCfg.Attributes_conns)) + for idx, attrConn := range *jsnCfg.Attributes_conns { + // if we have the connection internal we change the name so we can have internal rpc for each subsystem + if attrConn == utils.MetaInternal { + cS.AttributeSConns[idx] = utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes) + } else { + cS.AttributeSConns[idx] = attrConn + } } } if jsnCfg.String_indexed_fields != nil { diff --git a/config/chargerscfg_test.go b/config/chargerscfg_test.go index e83397127..4d24d5936 100644 --- a/config/chargerscfg_test.go +++ b/config/chargerscfg_test.go @@ -44,7 +44,7 @@ func TestChargerSCfgloadFromJsonCfg(t *testing.T) { }` expected = ChargerSCfg{ Enabled: true, - AttributeSConns: []*RemoteHost{}, + AttributeSConns: []string{}, PrefixIndexedFields: &[]string{"index1", "index2"}, } if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil { diff --git a/config/config_it_test.go b/config/config_it_test.go index c9dc2e00e..2c70c94da 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -126,12 +126,7 @@ func TestCGRConfigReloadChargerS(t *testing.T) { StringIndexedFields: &[]string{utils.Account}, PrefixIndexedFields: &[]string{}, IndexedSelects: true, - AttributeSConns: []*RemoteHost{ - &RemoteHost{ - Address: "127.0.0.1:2012", - Transport: utils.MetaJSON, - }, - }, + AttributeSConns: []string{"*localhost"}, } if !reflect.DeepEqual(expAttr, cfg.ChargerSCfg()) { t.Errorf("Expected %s , received: %s ", utils.ToJSON(expAttr), utils.ToJSON(cfg.ChargerSCfg())) diff --git a/config/config_json_test.go b/config/config_json_test.go index 49eccab9a..2131fdb34 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -863,7 +863,7 @@ func TestDfChargerServJsonCfg(t *testing.T) { eCfg := &ChargerSJsonCfg{ Enabled: utils.BoolPointer(false), Indexed_selects: utils.BoolPointer(true), - Attributes_conns: &[]*RemoteHostJson{}, + Attributes_conns: &[]string{}, String_indexed_fields: nil, Prefix_indexed_fields: &[]string{}, } diff --git a/config/config_test.go b/config/config_test.go index 18e3369cf..321d2bc0a 100755 --- a/config/config_test.go +++ b/config/config_test.go @@ -816,7 +816,7 @@ func TestCgrCfgJSONDefaultSChargerSCfg(t *testing.T) { eChargerSCfg := &ChargerSCfg{ Enabled: false, IndexedSelects: true, - AttributeSConns: []*RemoteHost{}, + AttributeSConns: []string{}, StringIndexedFields: nil, PrefixIndexedFields: &[]string{}, } diff --git a/config/configsanity.go b/config/configsanity.go index f74a6d352..fdf923d9c 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -316,12 +316,14 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> process_runs needs to be bigger than 0", utils.AttributeS) } } - if cfg.chargerSCfg.Enabled && !cfg.dispatcherSCfg.Enabled && - (cfg.attributeSCfg == nil || !cfg.attributeSCfg.Enabled) { - for _, connCfg := range cfg.chargerSCfg.AttributeSConns { - if connCfg.Address == utils.MetaInternal { + if cfg.chargerSCfg.Enabled { + for _, connID := range cfg.chargerSCfg.AttributeSConns { + if strings.HasPrefix(connID, utils.MetaInternal) && !cfg.attributeSCfg.Enabled { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.ChargerS) } + if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { + return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ChargerS, connID) + } } } // ResourceLimiter checks @@ -375,6 +377,9 @@ func (cfg *CGRConfig) checkConfigSanity() error { // EventReader sanity checks if cfg.ersCfg.Enabled { for _, connID := range cfg.ersCfg.SessionSConns { + if strings.HasPrefix(connID, utils.MetaInternal) && !cfg.sessionSCfg.Enabled { + return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.ERs) + } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ERs, connID) } diff --git a/config/configsanity_test.go b/config/configsanity_test.go index 803fab445..14ddb6629 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -517,12 +517,9 @@ func TestConfigSanityHTTPAgent(t *testing.T) { } cfg.chargerSCfg.Enabled = true - cfg.chargerSCfg.AttributeSConns = []*RemoteHost{ - &RemoteHost{ - Address: utils.MetaInternal, - }, - } - expected = " not enabled but requested by component." + cfg.chargerSCfg.AttributeSConns = []string{"Invalid"} + + expected = " Connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 839f4201f..79b3bb588 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -405,7 +405,7 @@ type AttributeSJsonCfg struct { type ChargerSJsonCfg struct { Enabled *bool Indexed_selects *bool - Attributes_conns *[]*RemoteHostJson + Attributes_conns *[]string String_indexed_fields *[]string Prefix_indexed_fields *[]string } diff --git a/data/conf/samples/acc_balance_keep/cgrates.json b/data/conf/samples/acc_balance_keep/cgrates.json index bac65ab15..76256c201 100644 --- a/data/conf/samples/acc_balance_keep/cgrates.json +++ b/data/conf/samples/acc_balance_keep/cgrates.json @@ -76,9 +76,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/acc_balance_keep_gob/cgrates.json b/data/conf/samples/acc_balance_keep_gob/cgrates.json index fa1d39010..89b2ccd1d 100644 --- a/data/conf/samples/acc_balance_keep_gob/cgrates.json +++ b/data/conf/samples/acc_balance_keep_gob/cgrates.json @@ -76,9 +76,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/cdrewithattributes/cgrates.json b/data/conf/samples/cdrewithattributes/cgrates.json index 0c6cfd0f7..e8c614be8 100755 --- a/data/conf/samples/cdrewithattributes/cgrates.json +++ b/data/conf/samples/cdrewithattributes/cgrates.json @@ -71,9 +71,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/cdrewithfilter/cgrates.json b/data/conf/samples/cdrewithfilter/cgrates.json index 32fb4f794..6cd9700b4 100755 --- a/data/conf/samples/cdrewithfilter/cgrates.json +++ b/data/conf/samples/cdrewithfilter/cgrates.json @@ -78,9 +78,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/cdrsv2internal/cgrates.json b/data/conf/samples/cdrsv2internal/cgrates.json index 1c914b0ad..23acbf23c 100644 --- a/data/conf/samples/cdrsv2internal/cgrates.json +++ b/data/conf/samples/cdrsv2internal/cgrates.json @@ -62,9 +62,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/cdrsv2mongo/cgrates.json b/data/conf/samples/cdrsv2mongo/cgrates.json index 33e534f0f..5a7cb9608 100644 --- a/data/conf/samples/cdrsv2mongo/cgrates.json +++ b/data/conf/samples/cdrsv2mongo/cgrates.json @@ -63,9 +63,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/cdrsv2mongo_gob/cgrates.json b/data/conf/samples/cdrsv2mongo_gob/cgrates.json index 81a7e9965..267c27919 100644 --- a/data/conf/samples/cdrsv2mongo_gob/cgrates.json +++ b/data/conf/samples/cdrsv2mongo_gob/cgrates.json @@ -63,9 +63,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/cdrsv2mysql/cdrsv2mysql.json b/data/conf/samples/cdrsv2mysql/cdrsv2mysql.json index 364a19179..1d5889995 100644 --- a/data/conf/samples/cdrsv2mysql/cdrsv2mysql.json +++ b/data/conf/samples/cdrsv2mysql/cdrsv2mysql.json @@ -63,9 +63,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/cdrsv2mysql_gob/cdrsv2mysql.json b/data/conf/samples/cdrsv2mysql_gob/cdrsv2mysql.json index cfd45f855..cd9a36cf5 100644 --- a/data/conf/samples/cdrsv2mysql_gob/cdrsv2mysql.json +++ b/data/conf/samples/cdrsv2mysql_gob/cdrsv2mysql.json @@ -63,9 +63,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/cdrsv2psql/cdrsv2psql.json b/data/conf/samples/cdrsv2psql/cdrsv2psql.json index 5f2d56480..274518ffd 100644 --- a/data/conf/samples/cdrsv2psql/cdrsv2psql.json +++ b/data/conf/samples/cdrsv2psql/cdrsv2psql.json @@ -63,9 +63,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "apier": { diff --git a/data/conf/samples/dispatchers/all/cgrates.json b/data/conf/samples/dispatchers/all/cgrates.json index 487d7663b..17a2edeab 100644 --- a/data/conf/samples/dispatchers/all/cgrates.json +++ b/data/conf/samples/dispatchers/all/cgrates.json @@ -39,9 +39,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "thresholds": { diff --git a/data/conf/samples/dispatchers/all2/cgrates.json b/data/conf/samples/dispatchers/all2/cgrates.json index 34d4d417b..c48c77b67 100644 --- a/data/conf/samples/dispatchers/all2/cgrates.json +++ b/data/conf/samples/dispatchers/all2/cgrates.json @@ -39,9 +39,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, "thresholds": { diff --git a/data/conf/samples/ers/cgrates.json b/data/conf/samples/ers/cgrates.json index a3ad6ea93..7cda37d55 100644 --- a/data/conf/samples/ers/cgrates.json +++ b/data/conf/samples/ers/cgrates.json @@ -34,9 +34,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/ers_example/cgrates.json b/data/conf/samples/ers_example/cgrates.json index 3d3c3e626..4491afb2f 100644 --- a/data/conf/samples/ers_example/cgrates.json +++ b/data/conf/samples/ers_example/cgrates.json @@ -33,9 +33,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/ers_reload/disabled/cgrates.json b/data/conf/samples/ers_reload/disabled/cgrates.json index 0f88e2596..afa905d7c 100644 --- a/data/conf/samples/ers_reload/disabled/cgrates.json +++ b/data/conf/samples/ers_reload/disabled/cgrates.json @@ -33,9 +33,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/ers_reload/first_reload/cgrates.json b/data/conf/samples/ers_reload/first_reload/cgrates.json index c3832c5a7..bd495ea90 100644 --- a/data/conf/samples/ers_reload/first_reload/cgrates.json +++ b/data/conf/samples/ers_reload/first_reload/cgrates.json @@ -33,9 +33,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/ers_reload/internal/cgrates.json b/data/conf/samples/ers_reload/internal/cgrates.json index f2cfeb632..712c1d783 100644 --- a/data/conf/samples/ers_reload/internal/cgrates.json +++ b/data/conf/samples/ers_reload/internal/cgrates.json @@ -33,9 +33,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/ers_reload/second_reload/cgrates.json b/data/conf/samples/ers_reload/second_reload/cgrates.json index 090e5da20..282b0274b 100644 --- a/data/conf/samples/ers_reload/second_reload/cgrates.json +++ b/data/conf/samples/ers_reload/second_reload/cgrates.json @@ -33,9 +33,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/httpagent/cgrates.json b/data/conf/samples/httpagent/cgrates.json index 04f4b8c49..9d47dea62 100644 --- a/data/conf/samples/httpagent/cgrates.json +++ b/data/conf/samples/httpagent/cgrates.json @@ -48,9 +48,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/httpagent_gob/cgrates.json b/data/conf/samples/httpagent_gob/cgrates.json index 436174db2..0b05460d6 100644 --- a/data/conf/samples/httpagent_gob/cgrates.json +++ b/data/conf/samples/httpagent_gob/cgrates.json @@ -48,9 +48,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/httpagenttls/cgrates.json b/data/conf/samples/httpagenttls/cgrates.json index 3b24942fd..b011a248d 100755 --- a/data/conf/samples/httpagenttls/cgrates.json +++ b/data/conf/samples/httpagenttls/cgrates.json @@ -59,9 +59,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/httpagenttls_gob/cgrates.json b/data/conf/samples/httpagenttls_gob/cgrates.json index 9dc89f62a..0c982d105 100755 --- a/data/conf/samples/httpagenttls_gob/cgrates.json +++ b/data/conf/samples/httpagenttls_gob/cgrates.json @@ -59,9 +59,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/loaders/tutmongo/cgrates.json b/data/conf/samples/loaders/tutmongo/cgrates.json index 6dfbdefa3..737264b60 100644 --- a/data/conf/samples/loaders/tutmongo/cgrates.json +++ b/data/conf/samples/loaders/tutmongo/cgrates.json @@ -72,9 +72,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/loaders/tutmysql/cgrates.json b/data/conf/samples/loaders/tutmysql/cgrates.json index 7a432da2e..bfeb9c683 100644 --- a/data/conf/samples/loaders/tutmysql/cgrates.json +++ b/data/conf/samples/loaders/tutmysql/cgrates.json @@ -115,9 +115,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/rpccaching/cgrates.json b/data/conf/samples/rpccaching/cgrates.json index 131a5edb6..137ffe181 100644 --- a/data/conf/samples/rpccaching/cgrates.json +++ b/data/conf/samples/rpccaching/cgrates.json @@ -45,9 +45,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/sessions/cgrates.json b/data/conf/samples/sessions/cgrates.json index 4c26382d1..fd55b77b1 100644 --- a/data/conf/samples/sessions/cgrates.json +++ b/data/conf/samples/sessions/cgrates.json @@ -44,9 +44,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/sessions_replication/smgreplcmaster/cgrates.json b/data/conf/samples/sessions_replication/smgreplcmaster/cgrates.json index 12356507d..80e40d1ed 100644 --- a/data/conf/samples/sessions_replication/smgreplcmaster/cgrates.json +++ b/data/conf/samples/sessions_replication/smgreplcmaster/cgrates.json @@ -35,9 +35,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/sessions_replication/smgreplcslave/cgrates.json b/data/conf/samples/sessions_replication/smgreplcslave/cgrates.json index ef0c32a9e..6350c90f5 100644 --- a/data/conf/samples/sessions_replication/smgreplcslave/cgrates.json +++ b/data/conf/samples/sessions_replication/smgreplcslave/cgrates.json @@ -35,9 +35,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smg/cgrates.json b/data/conf/samples/smg/cgrates.json index 4617807d7..eec964432 100644 --- a/data/conf/samples/smg/cgrates.json +++ b/data/conf/samples/smg/cgrates.json @@ -50,9 +50,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smg_automatic_debits/cgrates.json b/data/conf/samples/smg_automatic_debits/cgrates.json index 48a335635..6d58c654a 100644 --- a/data/conf/samples/smg_automatic_debits/cgrates.json +++ b/data/conf/samples/smg_automatic_debits/cgrates.json @@ -29,9 +29,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smg_gob/cgrates.json b/data/conf/samples/smg_gob/cgrates.json index ca1496bbd..bbe142e69 100644 --- a/data/conf/samples/smg_gob/cgrates.json +++ b/data/conf/samples/smg_gob/cgrates.json @@ -50,9 +50,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smgeneric/cgrates.json b/data/conf/samples/smgeneric/cgrates.json index c70011763..44a0c41de 100644 --- a/data/conf/samples/smgeneric/cgrates.json +++ b/data/conf/samples/smgeneric/cgrates.json @@ -40,9 +40,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/smgreplcmaster/cgrates.json b/data/conf/samples/smgreplcmaster/cgrates.json index 2721bb0d4..3ef8da5c2 100644 --- a/data/conf/samples/smgreplcmaster/cgrates.json +++ b/data/conf/samples/smgreplcmaster/cgrates.json @@ -35,9 +35,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smgreplcmaster_gob/cgrates.json b/data/conf/samples/smgreplcmaster_gob/cgrates.json index 87a7935f7..ac47877cd 100644 --- a/data/conf/samples/smgreplcmaster_gob/cgrates.json +++ b/data/conf/samples/smgreplcmaster_gob/cgrates.json @@ -35,9 +35,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smgreplcslave/cgrates.json b/data/conf/samples/smgreplcslave/cgrates.json index 7a6ff18b9..6fbfbd80d 100644 --- a/data/conf/samples/smgreplcslave/cgrates.json +++ b/data/conf/samples/smgreplcslave/cgrates.json @@ -35,9 +35,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/smgreplcslave_gob/cgrates.json b/data/conf/samples/smgreplcslave_gob/cgrates.json index a83c524a0..d1cbbc4e4 100644 --- a/data/conf/samples/smgreplcslave_gob/cgrates.json +++ b/data/conf/samples/smgreplcslave_gob/cgrates.json @@ -35,9 +35,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, "sessions": { diff --git a/data/conf/samples/tls/cgrates.json b/data/conf/samples/tls/cgrates.json index 28592cc65..b920c9131 100755 --- a/data/conf/samples/tls/cgrates.json +++ b/data/conf/samples/tls/cgrates.json @@ -101,9 +101,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, } diff --git a/data/conf/samples/tls_gob/cgrates.json b/data/conf/samples/tls_gob/cgrates.json index 0acb7b5bd..9a96e9d56 100755 --- a/data/conf/samples/tls_gob/cgrates.json +++ b/data/conf/samples/tls_gob/cgrates.json @@ -101,9 +101,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, } diff --git a/data/conf/samples/tutinternal/cgrates.json b/data/conf/samples/tutinternal/cgrates.json index 6f60dede4..cea07d8e6 100644 --- a/data/conf/samples/tutinternal/cgrates.json +++ b/data/conf/samples/tutinternal/cgrates.json @@ -58,9 +58,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/tutmongo/cgrates.json b/data/conf/samples/tutmongo/cgrates.json index 4548b093d..d24ee1731 100644 --- a/data/conf/samples/tutmongo/cgrates.json +++ b/data/conf/samples/tutmongo/cgrates.json @@ -73,9 +73,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/tutmongo2/cgrates.json b/data/conf/samples/tutmongo2/cgrates.json index 172103467..ae3547dbf 100644 --- a/data/conf/samples/tutmongo2/cgrates.json +++ b/data/conf/samples/tutmongo2/cgrates.json @@ -134,9 +134,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "127.0.0.1:2012", "transport":"*json"} - ], + "attributes_conns": ["*localhost"], "string_indexed_fields": ["Account"] }, diff --git a/data/conf/samples/tutmongo2_gob/cgrates.json b/data/conf/samples/tutmongo2_gob/cgrates.json index 03b5aa7b8..8fd5876a9 100644 --- a/data/conf/samples/tutmongo2_gob/cgrates.json +++ b/data/conf/samples/tutmongo2_gob/cgrates.json @@ -8,6 +8,13 @@ "log_level": 7 }, +"rpc_conns": { + "conn1": { + "strategy": "first", + "conns": [{{"address": "127.0.0.1:2013", "transport":"*gob"},}], + }, +}, + "listen": { "rpc_json": ":2012", @@ -134,9 +141,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "127.0.0.1:2013", "transport":"*gob"} - ], + "attributes_conns": ["conn1"], "string_indexed_fields": ["Account"] }, diff --git a/data/conf/samples/tutmongo_gob/cgrates.json b/data/conf/samples/tutmongo_gob/cgrates.json index 31a5ce82c..0f31263fa 100644 --- a/data/conf/samples/tutmongo_gob/cgrates.json +++ b/data/conf/samples/tutmongo_gob/cgrates.json @@ -73,9 +73,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/tutmongonew/cgrates.json b/data/conf/samples/tutmongonew/cgrates.json index 92fbda60d..4dccd3883 100644 --- a/data/conf/samples/tutmongonew/cgrates.json +++ b/data/conf/samples/tutmongonew/cgrates.json @@ -72,9 +72,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/tutmysql/cgrates.json b/data/conf/samples/tutmysql/cgrates.json index 82db90759..802312978 100644 --- a/data/conf/samples/tutmysql/cgrates.json +++ b/data/conf/samples/tutmysql/cgrates.json @@ -78,9 +78,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/tutmysql2/cgrates.json b/data/conf/samples/tutmysql2/cgrates.json index 2e683020c..2e4bcb2d4 100644 --- a/data/conf/samples/tutmysql2/cgrates.json +++ b/data/conf/samples/tutmysql2/cgrates.json @@ -99,9 +99,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "127.0.0.1:2012", "transport":"*json"} - ], + "attributes_conns": ["*localhost"], "string_indexed_fields": ["Account"] }, diff --git a/data/conf/samples/tutmysql2_gob/cgrates.json b/data/conf/samples/tutmysql2_gob/cgrates.json index 6a82a1bfb..221c6627a 100644 --- a/data/conf/samples/tutmysql2_gob/cgrates.json +++ b/data/conf/samples/tutmysql2_gob/cgrates.json @@ -9,6 +9,14 @@ }, +"rpc_conns": { + "conn1": { + "strategy": "first", + "conns": [{{"address": "127.0.0.1:2013", "transport":"*gob"},}], + }, +}, + + "listen": { "rpc_json": ":2012", "rpc_gob": ":2013", @@ -99,9 +107,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "127.0.0.1:2013", "transport":"*gob"} - ], + "attributes_conns": ["conn1"], "string_indexed_fields": ["Account"] }, diff --git a/data/conf/samples/tutmysql_internal/cgrates.json b/data/conf/samples/tutmysql_internal/cgrates.json index 96711acfc..ddd3813cf 100644 --- a/data/conf/samples/tutmysql_internal/cgrates.json +++ b/data/conf/samples/tutmysql_internal/cgrates.json @@ -197,9 +197,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"}, - ], + "attributes_conns": ["*internal"], }, diff --git a/data/conf/samples/tutpostgres/cgrates.json b/data/conf/samples/tutpostgres/cgrates.json index 4fce0417a..d624ca9b6 100644 --- a/data/conf/samples/tutpostgres/cgrates.json +++ b/data/conf/samples/tutpostgres/cgrates.json @@ -86,9 +86,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorial_tests/asterisk_ari/cgrates/etc/cgrates/cgrates.json b/data/tutorial_tests/asterisk_ari/cgrates/etc/cgrates/cgrates.json index f16f67d05..b0dfe8613 100644 --- a/data/tutorial_tests/asterisk_ari/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorial_tests/asterisk_ari/cgrates/etc/cgrates/cgrates.json @@ -52,9 +52,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorial_tests/fs_evsock/cgrates/etc/cgrates/cgrates.json b/data/tutorial_tests/fs_evsock/cgrates/etc/cgrates/cgrates.json index 0a395d21f..c277fa694 100644 --- a/data/tutorial_tests/fs_evsock/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorial_tests/fs_evsock/cgrates/etc/cgrates/cgrates.json @@ -51,9 +51,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorial_tests/kamevapi/cgrates/etc/cgrates/cgrates.json b/data/tutorial_tests/kamevapi/cgrates/etc/cgrates/cgrates.json index 1b188e04f..20f879a5a 100644 --- a/data/tutorial_tests/kamevapi/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorial_tests/kamevapi/cgrates/etc/cgrates/cgrates.json @@ -49,9 +49,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorial_tests/osips/cgrates/etc/cgrates/cgrates.json b/data/tutorial_tests/osips/cgrates/etc/cgrates/cgrates.json index ca69cd59c..9698418d3 100644 --- a/data/tutorial_tests/osips/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorial_tests/osips/cgrates/etc/cgrates/cgrates.json @@ -50,9 +50,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json b/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json index 4075ad43f..90b7e3ea2 100644 --- a/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/asterisk_ari/cgrates/etc/cgrates/cgrates.json @@ -52,9 +52,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json b/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json index 0a395d21f..c277fa694 100644 --- a/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/fs_evsock/cgrates/etc/cgrates/cgrates.json @@ -51,9 +51,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json b/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json index 679100fca..8e6aae082 100644 --- a/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json @@ -49,9 +49,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/data/tutorials/osips/cgrates/etc/cgrates/cgrates.json b/data/tutorials/osips/cgrates/etc/cgrates/cgrates.json index 079dd1b89..067378892 100644 --- a/data/tutorials/osips/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/osips/cgrates/etc/cgrates/cgrates.json @@ -50,9 +50,7 @@ "chargers": { "enabled": true, - "attributes_conns": [ - {"address": "*internal"} - ], + "attributes_conns": ["*internal"], }, diff --git a/engine/chargers.go b/engine/chargers.go index 9e452cd7d..3d8867591 100644 --- a/engine/chargers.go +++ b/engine/chargers.go @@ -19,31 +19,25 @@ along with this program. If not, see package engine import ( - "errors" "fmt" - "reflect" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" ) func NewChargerService(dm *DataManager, filterS *FilterS, - attrS rpcclient.ClientConnector, - cfg *config.CGRConfig) (*ChargerService, error) { - if attrS != nil && reflect.ValueOf(attrS).IsNil() { - attrS = nil - } + cfg *config.CGRConfig, connMgr *ConnManager) (*ChargerService, error) { + return &ChargerService{dm: dm, filterS: filterS, - attrS: attrS, cfg: cfg}, nil + cfg: cfg, connMgr: connMgr}, nil } // ChargerService is performing charging type ChargerService struct { dm *DataManager filterS *FilterS - attrS rpcclient.ClientConnector cfg *config.CGRConfig + connMgr *ConnManager } // ListenAndServe will initialize the service @@ -126,9 +120,6 @@ func (cS *ChargerService) processEvent(cgrEv *utils.CGREventWithArgDispatcher) ( if len(cP.AttributeIDs) == 1 && cP.AttributeIDs[0] == utils.META_NONE { continue // AttributeS disabled } - if cS.attrS == nil { - return nil, errors.New("no connection to AttributeS") - } args := &AttrArgsProcessEvent{ AttributeIDs: cP.AttributeIDs, @@ -138,7 +129,7 @@ func (cS *ChargerService) processEvent(cgrEv *utils.CGREventWithArgDispatcher) ( ArgDispatcher: clonedEv.ArgDispatcher, } var evReply AttrSProcessEventReply - if err = cS.attrS.Call(utils.AttributeSv1ProcessEvent, + if err = cS.connMgr.Call(cS.cfg.ChargerSCfg().AttributeSConns, utils.AttributeSv1ProcessEvent, args, &evReply); err != nil { return nil, err } @@ -181,9 +172,3 @@ func (cS *ChargerService) V1GetChargersForEvent(args *utils.CGREventWithArgDispa *rply = cPs return } - -// SetAttributeConnection sets the new connection to the attribute service -// only used on reload -func (cS *ChargerService) SetAttributeConnection(attrS rpcclient.ClientConnector) { - cS.attrS = attrS -} diff --git a/engine/chargers_test.go b/engine/chargers_test.go index 5ac344ab7..873054256 100755 --- a/engine/chargers_test.go +++ b/engine/chargers_test.go @@ -108,7 +108,7 @@ func TestChargerPopulateChargerService(t *testing.T) { t.Errorf("Error: %+v", err) } chargerSrv, err = NewChargerService(dmCharger, - &FilterS{dm: dmCharger, cfg: defaultCfg}, nil, defaultCfg) + &FilterS{dm: dmCharger, cfg: defaultCfg}, defaultCfg, nil) if err != nil { t.Errorf("Error: %+v", err) } diff --git a/services/chargers.go b/services/chargers.go index b70eb9ef9..a08378a65 100644 --- a/services/chargers.go +++ b/services/chargers.go @@ -33,29 +33,27 @@ import ( // NewChargerService returns the Charger Service func NewChargerService(cfg *config.CGRConfig, dm *DataDBService, cacheS *engine.CacheS, filterSChan chan *engine.FilterS, server *utils.Server, - attrsChan, dispatcherChan chan rpcclient.ClientConnector) servmanager.Service { + internalChargerSChan chan rpcclient.RpcClientConnection, connMgr *engine.ConnManager) servmanager.Service { return &ChargerService{ - connChan: make(chan rpcclient.ClientConnector, 1), - cfg: cfg, - dm: dm, - cacheS: cacheS, - filterSChan: filterSChan, - server: server, - attrsChan: attrsChan, - dispatcherChan: dispatcherChan, + connChan: internalChargerSChan, + cfg: cfg, + dm: dm, + cacheS: cacheS, + filterSChan: filterSChan, + server: server, + connMgr: connMgr, } } // ChargerService implements Service interface type ChargerService struct { sync.RWMutex - cfg *config.CGRConfig - dm *DataDBService - cacheS *engine.CacheS - filterSChan chan *engine.FilterS - server *utils.Server - attrsChan chan rpcclient.ClientConnector - dispatcherChan chan rpcclient.ClientConnector + cfg *config.CGRConfig + dm *DataDBService + cacheS *engine.CacheS + filterSChan chan *engine.FilterS + server *utils.Server + connMgr *engine.ConnManager chrS *engine.ChargerService rpc *v1.ChargerSv1 @@ -74,15 +72,9 @@ func (chrS *ChargerService) Start() (err error) { filterS := <-chrS.filterSChan chrS.filterSChan <- filterS - var attrSConn rpcclient.ClientConnector - if attrSConn, err = NewConnection(chrS.cfg, chrS.attrsChan, chrS.dispatcherChan, chrS.cfg.ChargerSCfg().AttributeSConns); err != nil { - utils.Logger.Crit(fmt.Sprintf("<%s> Could not connect to %s: %s", - utils.ChargerS, utils.AttributeS, err.Error())) - return - } chrS.Lock() defer chrS.Unlock() - if chrS.chrS, err = engine.NewChargerService(chrS.dm.GetDM(), filterS, attrSConn, chrS.cfg); err != nil { + if chrS.chrS, err = engine.NewChargerService(chrS.dm.GetDM(), filterS, chrS.cfg, chrS.connMgr); err != nil { utils.Logger.Crit( fmt.Sprintf("<%s> Could not init, error: %s", utils.ChargerS, err.Error())) @@ -104,15 +96,6 @@ func (chrS *ChargerService) GetIntenternalChan() (conn chan rpcclient.ClientConn // Reload handles the change of config func (chrS *ChargerService) Reload() (err error) { - var attrSConn rpcclient.ClientConnector - if attrSConn, err = NewConnection(chrS.cfg, chrS.attrsChan, chrS.dispatcherChan, chrS.cfg.ChargerSCfg().AttributeSConns); err != nil { - utils.Logger.Crit(fmt.Sprintf("<%s> Could not connect to %s: %s", - utils.ChargerS, utils.AttributeS, err.Error())) - return - } - chrS.Lock() - chrS.chrS.SetAttributeConnection(attrSConn) - chrS.Unlock() return } diff --git a/services/chargers_it_test.go b/services/chargers_it_test.go index 75d6f3010..1ad519bd1 100644 --- a/services/chargers_it_test.go +++ b/services/chargers_it_test.go @@ -51,8 +51,8 @@ func TestChargerSReload(t *testing.T) { server := utils.NewServer() srvMngr := servmanager.NewServiceManager(cfg, engineShutdown) db := NewDataDBService(cfg) - attrS := NewAttributeService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1)) - chrS := NewChargerService(cfg, db, chS, filterSChan, server, attrS.GetIntenternalChan(), nil) + attrS := NewAttributeService(cfg, db, chS, filterSChan, server, make(chan rpcclient.RpcClientConnection, 1)) + chrS := NewChargerService(cfg, db, chS, filterSChan, server, make(chan rpcclient.RpcClientConnection, 1), nil) srvMngr.AddServices(NewConnManagerService(cfg, nil), attrS, chrS, NewLoaderService(cfg, db, filterSChan, server, nil, nil, engineShutdown), db) if err = srvMngr.StartServices(); err != nil { t.Error(err) diff --git a/services/sessions_it_test.go b/services/sessions_it_test.go index 92c6e175b..10da6ee38 100644 --- a/services/sessions_it_test.go +++ b/services/sessions_it_test.go @@ -70,8 +70,8 @@ func TestSessionSReload(t *testing.T) { db := NewDataDBService(cfg) cfg.StorDbCfg().Type = utils.INTERNAL stordb := NewStorDBService(cfg) - chrS := NewChargerService(cfg, db, chS, filterSChan, server, nil, nil) - schS := NewSchedulerService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil) + chrS := NewChargerService(cfg, db, chS, filterSChan, server, make(chan rpcclient.RpcClientConnection, 1), nil) + schS := NewSchedulerService(cfg, db, chS, filterSChan, server, make(chan rpcclient.RpcClientConnection, 1), nil) ralS := NewRalService(cfg, db, stordb, chS, filterSChan, server, /*tS*/ internalChan, internalChan, cacheSChan, internalChan, internalChan, internalChan, schS, engineShutdown)