Added option for field separator for Event Exporter Config and refactored some opts

This commit is contained in:
andronache
2021-05-11 08:36:42 +03:00
committed by Dan Christian Bogos
parent 6453699baf
commit d63418f260
11 changed files with 30 additions and 24 deletions

View File

@@ -377,8 +377,8 @@ const CGRATES_CFG_JSON = `
// AMQP
// "consumerTag": "cgrates", // the ID of the consumer
// "sqlExchange": "",
// "sqlExchangeType": "",
// "amqpExchange": "",
// "amqpExchangeType": "",
// "amqpRoutingKey": "",
// "exchangeProcessed": "",
@@ -487,8 +487,8 @@ const CGRATES_CFG_JSON = `
// AMQP
// "amqpQueueID": "cgrates_cdrs", // the queue id for AMQP exporters from were the events are exported
// "amqpRoutingKey": "", // RoutingKey
// "sqlExchange": "", // Exchange
// "sqlExchangeType": "", // ExchangeType
// "amqpExchange": "", // Exchange
// "amqpExchangeType": "", // ExchangeType
// SQS and S3

View File

@@ -356,8 +356,8 @@
// // AMQP
// // "consumerTag": "cgrates", // the ID of the consumer
// // "sqlExchange": "",
// // "sqlExchangeType": "",
// // "amqpExchange": "",
// // "amqpExchangeType": "",
// // "amqpRoutingKey": "",
// // "exchangeProcessed": "",

View File

@@ -65,8 +65,8 @@
"export_path": "amqp://guest:guest@localhost:5672/",
"opts": {
"amqpQueueID": "cgrates_cdrs",
"sqlExchange": "exchangename",
"sqlExchangeType": "fanout",
"amqpExchange": "exchangename",
"amqpExchangeType": "fanout",
"amqpRoutingKey": "cgr_cdrs"
},
"tenant": "cgrates.org",

View File

@@ -70,8 +70,8 @@
"export_path": "amqp://guest:guest@localhost:5672/",
"opts": {
"amqpQueueID": "cgrates_cdrs",
"sqlExchange": "exchangename",
"sqlExchangeType": "fanout",
"amqpExchange": "exchangename",
"amqpExchangeType": "fanout",
"amqpRoutingKey": "cgr_cdrs",
},
"tenant": "cgrates.org",

View File

@@ -67,8 +67,8 @@
"export_path": "amqp://guest:guest@localhost:5672/",
"opts": {
"amqpQueueID": "cgrates_cdrs",
"sqlExchange": "exchangename",
"sqlExchangeType": "fanout",
"amqpExchange": "exchangename",
"amqpExchangeType": "fanout",
"amqpRoutingKey": "cgr_cdrs",
},
"tenant": "cgrates.org",

View File

@@ -79,8 +79,8 @@
"export_path": "amqp://guest:guest@localhost:5672/",
"opts": {
"amqpQueueID": "cgrates_cdrs",
"sqlExchange": "exchangename",
"sqlExchangeType": "fanout",
"amqpExchange": "exchangename",
"amqpExchangeType": "fanout",
"amqpRoutingKey": "cgr_cdrs",
},
"tenant": "cgrates.org",

View File

@@ -77,8 +77,8 @@
"export_path": "amqp://guest:guest@localhost:5672/",
"opts": {
"amqpQueueID": "cgrates_cdrs",
"sqlExchange": "exchangename",
"sqlExchangeType": "fanout",
"amqpExchange": "exchangename",
"amqpExchangeType": "fanout",
"amqpRoutingKey": "cgr_cdrs",
},
"tenant": "cgrates.org",

View File

@@ -68,6 +68,9 @@ func (fCsv *FileCSVee) init() (err error) {
if len(fCsv.cgrCfg.EEsCfg().Exporters[fCsv.cfgIdx].FieldSep) > 0 {
fCsv.csvWriter.Comma = rune(fCsv.cgrCfg.EEsCfg().Exporters[fCsv.cfgIdx].FieldSep[0])
}
if fieldSep, has := fCsv.cgrCfg.EEsCfg().Exporters[fCsv.cfgIdx].Opts[utils.CSV+utils.FieldSepOpt]; has {
fCsv.csvWriter.Comma = rune(utils.IfaceAsString(fieldSep)[0])
}
return fCsv.composeHeader()
}

View File

@@ -37,10 +37,10 @@ func TestAMQPPosterParseURL(t *testing.T) {
routingKey: "CGRCDR",
}
opts := map[string]interface{}{
"amqpQueueID": "q1",
"sqlExchange": "E1",
"amqpRoutingKey": "CGRCDR",
"sqlExchangeType": "fanout",
"amqpQueueID": "q1",
"amqpExchange": "E1",
"amqpRoutingKey": "CGRCDR",
"amqpExchangeType": "fanout",
}
amqp.parseOpts(opts)
if !reflect.DeepEqual(expected, amqp) {

View File

@@ -46,8 +46,8 @@ func TestAMQPER(t *testing.T) {
"opts": {
"amqpQueueID": "cdrs3",
"consumerTag": "test-key",
"sqlExchange": "test-exchange",
"sqlExchangeType": "direct",
"amqpExchange": "test-exchange",
"amqpExchangeType": "direct",
"amqpRoutingKey": "test-key",
},
"processed_path": "", // move processed data here

View File

@@ -2543,8 +2543,8 @@ const (
// General constants for posters
DefaultQueueID = "cgrates_cdrs"
DefaultExchangeType = "direct"
Exchange = "sqlExchange"
ExchangeType = "sqlExchangeType"
Exchange = "amqpExchange"
ExchangeType = "amqpExchangeType"
RoutingKey = "amqpRoutingKey"
// for ers:
@@ -2567,6 +2567,9 @@ const (
S3Bucket = "s3BucketID"
SQSQueueID = "SQSQueueID"
//CSV
FieldSepOpt = "FieldSeparator"
)
// Analyzers constants