AccountS service skel

This commit is contained in:
DanB
2020-12-20 11:51:07 +01:00
parent 4569e4084b
commit 07353f8724
3 changed files with 70 additions and 1 deletions

68
accounts/accounts.go Normal file
View File

@@ -0,0 +1,68 @@
/*
Real-time Online/Offline Charging System (OerS) for Telecom & ISP environments
Copyright (C) ITsysCOM GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package accounts
import (
"fmt"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
// NewAccountS instantiates the AccountS
func NewAccountS(cfg *config.CGRConfig, fltrS *engine.FilterS, dm *engine.DataManager) *AccountS {
return &AccountS{
cfg: cfg,
fltrS: fltrS,
dm: dm,
}
}
// AccountS operates Accounts
type AccountS struct {
cfg *config.CGRConfig
fltrS *engine.FilterS
dm *engine.DataManager
}
// ListenAndServe keeps the service alive
func (aS *AccountS) ListenAndServe(stopChan, cfgRld chan struct{}) {
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s>",
utils.CoreS, utils.AccountS))
for {
select {
case <-stopChan:
return
case rld := <-cfgRld: // configuration was reloaded
cfgRld <- rld
}
}
}
// Shutdown is called to shutdown the service
func (aS *AccountS) Shutdown() (err error) {
utils.Logger.Info(fmt.Sprintf("<%s> shutdown <%s>", utils.CoreS, utils.AccountS))
return
}
// Call implements rpcclient.ClientConnector interface for internal RPC
func (aS *AccountS) Call(serviceMethod string, args interface{}, reply interface{}) error {
return utils.RPCCall(aS, serviceMethod, args, reply)
}

View File

@@ -1,2 +1,2 @@
#Tenant,ID,FilterIDs,ActivationInterval,Weight,BalanceID,BalanceFilterIDs,BalanceType,BalanceOpts,BalanceWeight,BalanceValue
#Tenant,ID,FilterIDs,ActivationInterval,Weight,BalanceID,BalanceFilterIDs,BalanceWeight,BalanceBlocker,BalanceType,BalanceOpts,BalanceValue
1 #Tenant ID FilterIDs ActivationInterval Weight BalanceID BalanceFilterIDs BalanceWeight BalanceBlocker BalanceType BalanceOpts BalanceValue
2

View File

@@ -530,6 +530,7 @@ const (
MetaFile = "*file"
Accounts = "Accounts"
AccountService = "AccountS"
AccountS = "AccountS"
Actions = "Actions"
ActionPlans = "ActionPlans"
ActionTriggers = "ActionTriggers"