mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added option for field separator for Event Exporter Config and refactored some opts
This commit is contained in:
committed by
Dan Christian Bogos
parent
6453699baf
commit
d63418f260
@@ -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
|
||||
|
||||
@@ -356,8 +356,8 @@
|
||||
|
||||
// // AMQP
|
||||
// // "consumerTag": "cgrates", // the ID of the consumer
|
||||
// // "sqlExchange": "",
|
||||
// // "sqlExchangeType": "",
|
||||
// // "amqpExchange": "",
|
||||
// // "amqpExchangeType": "",
|
||||
// // "amqpRoutingKey": "",
|
||||
|
||||
// // "exchangeProcessed": "",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user