Commit Graph

96 Commits

Author SHA1 Message Date
ionutboangiu
b1a5874215 Move config/rsrparser.go to utils package 2025-02-24 13:36:32 +01:00
ionutboangiu
36a7d174ab Remove RSRSep opt from general section
- allows RSRParser to be split gracefully from config (was depending on
  RSRSep, which was retrieved from the global config variable)
- default separator (;) was the only one used except for splitting
  inline attribute values (where ANDSep is used)
2025-02-24 13:36:32 +01:00
gezimbll
3ebf3007a5 added startdelay config option for ers readers 2025-01-29 14:44:28 +01:00
ionutboangiu
e3b5c9ef84 Implement getter method for EventExporterCfg (by ID)
Removed redundant getter method for default EventExporterCfg.
2025-01-29 10:52:24 +01:00
ionutboangiu
8cbeb45adf Remove global err used by tests
Removed many leftover error checks for NewDefaultCGRConfig,
which does not return an error anymore.
2024-10-29 18:54:51 +01:00
ionutboangiu
1c73e42307 Revise ERs event exporting
Make use of the previously added ees_success_ids and ees_failed_ids
configuration fields.

Remove Processed opts and everything related to them since they should
not be used anymore.

Fixed test compilation errors caused by the change.
2024-09-05 20:46:40 +02:00
ionutboangiu
795fc18195 Add ees_conns field option for ERs section
Add ees_success_ids and ees_failed_ids fields in reader config. The
former will be used to set EeIDs when the event processing returns
no error, while the latter will be used otherwise (implementation
will follow).

Add config sanity checks for the added options.
2024-09-05 20:46:40 +02:00
ionutboangiu
dc53171ce2 Add reconnects and max_reconnect_interval config options for ers
They are separate for each configured reader.

Additional changes:
 - rearrange config_defaults fields for ers/ees;
 - add comment for RunDelay config option inside struct definition;
 - improve comments for amqp opts in config_defaults.
2024-09-05 20:46:40 +02:00
ionutboangiu
4c34d321de Add sanity check to prevent xml reader panic
HierarchyPath parser now returns nil when
the path is empty (instead of a string slice with one
EmptyString element).

If isAbsolute is set to true, when calling the AsString
method on a nil HierarchyPath, only the separator will
be returned. Alternatively, if isAbsolute is false, it
will just return . to signal that the path currently
being processed is the one required.This avoids a nil
expr error coming from the xmlquery library.

Use the Query and QueryAll functions from the xmlquery
package to be able to handle the errors ourselves and
avoid panics.

Remove config default value for xmlRootPath. The field
will remain commented in config_defaults for reference.

Add tests for HierarchyPath.AsString function.

Add comments for XmlProvider and xmlRootPath opt.

Update XmlProvider String() func based on the comment
which specifies that it should display the already
parsed values out of cache.
2023-10-19 17:19:30 +02:00
ionutboangiu
d0a435aa6d Migrate to new jetstream API
Upgraded go.mod nats version due to an issue caused by version mismatch
between driver and server (uncertain).

Renamed function from getProcessOptions to getProcessedOptions.

## *NatsER.Serve

- Replaced ChanQueueSubscribe with QueueSubscribe for Core NATS consumer
to handle the message processing directly.

- Since QueueSubscribe is now used regardless of jetstream status, the
message handler has been assigned to a separate variable that can be
reused.

-  The message handler is now dealing with the message processing
directly, therefore the select case listening for the channel which is
feeding NATS messages can be removed together with the channel itself
and the select. Currently, the goroutine within Serve only has to block
until the rdrExit chan is closed.

- Moved the resource check inside the handler right before starting the
message processing goroutine.

## *NatsEE.parseOpts

- Renamed function from parseOpt to parseOpts.

- Handled the error coming from GetNatsOpts function.

## *NatsEE.Connect

- Updated function to return early in case of non-nil nats.Conn value
to reduce nesting.

## *NatsEE.ExportEvent

- Use defer to release resources and RUnlock.

## *NatsEE.Close

- Use defer to Unlock.

- Update function to return early in case of nil nats.Conn value to
reduce nesting.

## ees.GetNatsOpts

- Chose switch over if else when parsing client certificate and keys
opts.

- Updated function to return the errors directly instead of assigning
them to a separate variable right before returning.

## ers.GetNatsOpts

- Chose switch over if else when parsing client certificate and keys
opts.

- Updated function to return the errors directly instead of assigning
them to a separate variable right before returning.

Removed tab from commented natsJetStreamMaxWaitProcessed option
value in config_defaults.go under ers section.

Added integration test for ERs NATS.

Updated ees/ers implementation to use the jetstream package which
separates the jetstream context from Core NATS.

Removed the jsOpts fields from the NatsEE struct. We are now using the
jetStreamMaxWait option directly through a timeout context.

Added streamName option for NATS reader since it is now required to be
specified when creating a consumer (it is not inferred based on subject
anymore).

Updated nats ers integration tests.

Updated tests to also use the new jetstream package.

Updated tests to start the nats-server using their official driver
instead of using the std go exec package. time.Sleeps are now not
required anymore to wait for the server.

In test configurations for nats readers, made sure that natsStreamName
option is populated. It is now required for consumers to know where to
subscribe.
2023-09-28 20:48:39 +02:00
NikolasPetriti
24dde0f351 Add coverage tests for config 2023-09-11 12:20:45 +02:00
ionutboangiu
113e2a2bdf Replace interface{} with any 2023-05-31 10:22:28 +02:00
arberkatellari
27ad99e88c Improving covarage at /config 2022-11-30 16:58:04 +02:00
arberkatellari
6810efb7ef Improving coverage at /config 2022-11-30 16:58:04 +02:00
ionutboangiu
924a91c749 Change SSLMode to PgSSLMode 2022-07-03 13:08:52 +02:00
andronache98
ecdf5e54ea Changed headers 2022-03-09 14:14:30 +01:00
andronache98
9ec56f5155 Changed headers 2022-03-09 14:14:30 +01:00
andronache98
bb30b65ef5 Fixed tests using originID in event instead of opts 2022-02-06 09:52:26 +01:00
andronache98
ca839daa29 Changed CGRID to *originID and removed it in most places 2022-02-06 09:52:26 +01:00
nickolasdaniel
9ae95d387e Tests for config 2021-11-09 18:08:33 +02:00
nickolasdaniel
35d0e9bc71 Unit testing in config 2021-11-05 21:15:02 +02:00
ionutboangiu
6c01384554 Fix unit tests 2021-11-01 13:51:02 +02:00
ionutboangiu
aa46b1eefd Fix compilation errors after making ers opts into structs 2021-11-01 13:51:02 +02:00
nickolasdaniel
bc50993f80 Unit tests in config 2021-10-12 18:11:25 +03:00
Trial97
6a3f8ddc57 Updated config 2021-09-20 10:45:14 +02:00
ionutboangiu
26ee5f21f6 Remove partial_cache_action and partial_path from erscfg 2021-07-08 09:55:47 +02:00
andronache
503d3fe22c Make flags camel case for ers ees and agents 2021-07-03 16:42:50 +02:00
ionutboangiu
fc42259893 Change possible reader/exporter types format from snake case to camel case 2021-07-01 16:16:49 +02:00
Trial97
81f2d722f6 Added nats ees 2021-06-25 18:15:12 +02:00
nickolasdaniel
323646602c Finished unit testing in config 2021-06-09 20:14:34 +02:00
nickolasdaniel
6399c506a6 Added unit tests for config 2021-06-08 11:55:12 +02:00
nickolasdaniel
2909abb969 Added unit tests for config 2021-05-28 12:39:28 +03:00
nickolasdaniel
1c09bac041 Added unit tests for config 2021-05-19 15:54:39 +02:00
Trial97
c28ac62968 Updated flatstore tests 2021-05-19 15:54:14 +02:00
Trial97
7c109c5fd1 Updated config test 2021-05-06 14:00:37 +02:00
Trial97
45a11aa91e Updated s3 and sqs ers configs 2021-05-04 20:45:09 +02:00
Trial97
7aeeeec50c Updated ers config 2021-05-04 20:45:09 +02:00
Trial97
c04c0a5adb Added ConfigDB and option to read config from DB 2021-04-16 17:53:36 +02:00
porosnicuadrian
0f70d542f8 Fixed warnings in config package 2021-04-02 13:45:26 +02:00
Trial97
0a7446bdad Added Config in agent request as dataprovider 2021-02-09 15:16:20 +01:00
andronache
36da1a6309 Consts in utils 2021-01-11 10:57:44 +01:00
andronache
1470267727 Modified consts in utils 2021-01-07 18:15:35 +01:00
TeoV
5775d09c7b Add infrastructure for AccountS in DataManager 2020-12-21 10:19:59 +01:00
porosnicuadrian
711d7d5a1a Removed error from NewDefaultCGRConfig signature's function 2020-12-02 14:00:35 +01:00
Trial97
c539800acd Added more Clone functions for config sections 2020-11-27 08:41:56 +01:00
Trial97
2b19127d05 Added more Clone functions for config sections 2020-11-27 08:41:56 +01:00
Trial97
568df81745 Added cores package and tests for caps 2020-11-05 17:07:50 +01:00
porosnicuadrian
bbd303e2c0 Covered tests for config directory 2020-11-05 14:46:08 +01:00
Trial97
5da4cf6d1c Updated account action plans integration tests for cache 2020-10-31 20:52:09 +01:00
Trial97
b2db71f303 Added APIs to reload config from string 2020-10-29 17:55:26 +01:00