- 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)
- added hook support (executed after parsing config but before starting
engine)
- renamed TestEnvironment.Setup -> TestEngine.Run as it represents the
setup for a single cgr-engine instance
- replaced t.Log with t.Error for engine process kill error
- improved option comments
- added support for dynamic configuration for dbs
- ConfigJSON field can now be used to partially overwrite an existing
configuration
- extra cgr-engine flags can now be passed to the Run method
- added default db configs for mongo/internal
- implemented helper to load using cgr-loader
- made use of the test setup helpers.
- used t.Cleanup instead of defer.
- instead of waiting 50ms for the nats-server to start, used a helper
hook to attempt connections in fibonacci intervals. On success it
keeps a reference to the connection for later usage.
- handle error for stream delete function executed during cleanup.
- shorten time.Sleep durations when waiting for exports to finish.
- extract the cache itemID checking logic into a separate func
- retry failed requests in fibonacci intervals for up to 500ms
Applies to both file readers and loader (for loader, the blank statement
was used anyway).
It's redundant because for file readers, the rdr.sourceDir value was
always passed as the parameter when it was already part of the method's
object.
Parameter had to also be removed from the WatchDir function and the
functions it depends on.
They were failing after the ERs structure changes.
Added a commented helper program at the end of the test to
help generate credentials for testing nats JWT functionality
Implemented functionality that handles reconnecting to the amqp server
and reinitializing the amqp channel in case of errors and timeouts. This
is handled by a goroutine created in the client constructor (it also
handles the initial connect/init).
Reconnects and reinits will use a fibonacci backoff strategy, and the
attempt amount and max waiting interval can be adjusted by the
'reconnects' and 'max_reconnect_interval' config options.
Messages that fail processing are now dropped instead of being requeued,
preventing infinite processing loops. However, this means that the
messages are lost. Handling failed messages will need to be addressed
separately.
'concurrent_requests' will now set the prefetch count. Setting the
prefetch count using the Qos function was able to replace our old
approach that was using channels. Default value is 1024 which,
according to the rabbitmq docs, 'runs into the law of diminishing
returns'. The recommended value is between 100-300. Source:
https://www.rabbitmq.com/confirms.html#channel-qos-prefetch-throughput
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.
Remove cenkalti/rpc2 dependency and update client constructor.
Commented tests that only start and stop engine.
Fixed compilation errors caused by Azure/go-amqp update.
Remove cgrates/ugocodec dependency since we have everything
we need in ugoriji/go/codec and add tests for it.
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.
Previously, msg.Ack(true) was used, which is mostly used for batch
processing. It mistakenly acknowledged all previously unacknowledged
messages, causing errors from the AMQP server. Now, messages are
acknowledged individually after each one is processed.
Messages that ERs failed to process are now rejected and requeued
for future processing attempts.
The reader is now closed immediately if the message delivery
channel closes. Therefore, it prevents an endless loop by avoiding
continuous consumption from empty or closed channels.
Addresses: #4146
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.