Gets the container's communication manager.
Gets the container object of this controller.
Gets the controller's options as specified in the configuration options.
Gets the registered name of this controller.
The registered name is either defined by the corresponding key in the
Components.controllers
object in the container configuration, or by
invoking Container.registerController
method with this name.
Gets the container's Runtime object.
Whenever one of the controller's log methods (e.g. logDebug
, logInfo
,
logWarning
, logError
, logFatal
) is called by application code, the
controller creates a Log object with appropriate property values and
passes it to this method before advertising it.
You can override this method to additionally set certain properties (such
as LogHost.hostname
or Log.logLabels
). Ensure that
super.extendLogObject
is called in your override. The base method does
nothing.
log object to be extended before being advertised
Find snapshot objects in connected database which match a given filter.
object filter to apply to snapshot objects
Find snapshot objects in connected database for a specific object ID which are created within a certain time period.
The array of snapshot objects returned is ordered descendingly by creation timestamp.
object id from which snapshots were taken
start timestamp of filter interval (optional);
undefined
if unrestricted
end timestamp of filter interval (optional);
undefined
if unrestricted
Find all snapshot objects in connected database which are created within a certain time period.
start timestamp of filter interval (optional);
undefined
if unrestricted
end timestamp of filter interval (optional);
undefined
if unrestricted
Create a new snapshot object of the given object with a creation
timestamp set to Date.now()
.
The new snapshot object will be processed according to the controller options specified. The promise returned is resolved with the created snapshot after it has been advertised and/or persisted locally.
Note: Advertisement and persistence of snapshots are executed asynchronously. Whenever a snapshot is both persisted locally and advertised it is guaranteed that the snapshot has been stored in the database before being advertised. This also implies that Advertise events are not necessarily delivered in the same order in which snapshots were generated.
Object from which the snapshot will be created
String tags which can be used for filtering of (persisted) snapshot objects
Create a new snapshot object of the given object with the given creation timestamp.
The new snapshot object will be processed according to the controller options specified. The promise returned is resolved with the created snapshot after it has been advertised and/or persisted locally.
Note: Advertisement and persistence of snapshots are executed asynchronously. Whenever a snapshot is both persisted locally and advertised it is guaranteed that the snapshot has been stored in the database before being advertised. This also implies that Advertise events are not necessarily delivered in the same order in which snapshots were generated.
CoatyObject from which the snapshot will be created
creation timestamp of the snapshot
String tags which can be used for filtering of (persisted) snapshot objects
Advertise a Log object for debugging purposes.
a debug message
any number of log tags
Advertise a Log object for an error.
an error (object)
additional error message
any number of log tags
Advertise a Log object for an error with stacktrace information.
an error (object)
additional error message
any number of log tags
Advertise a Log object for a fatal error.
an error (object)
additional error message
any number of log tags
Advertise an informational Log object.
an informational message
any number of log tags
Advertise a Log object for a warning.
a warning message
any number of log tags
Called when the communication manager is about to start or restart.
Override this method to implement side effects here. Ensure that
super.onCommunicationManagerStarting
is called in your override. The
base implementation does nothing.
Called when the communication manager is about to stop.
Override this method to implement side effects here. Ensure that
super.onCommunicationManagerStopping
is called in your override. The
base implementation does nothing.
Called by the container when this instance should be disposed.
Implement cleanup side effects here. Ensure that super.onDispose
is
called in your override. The base implementation does nothing.
Called when the container has completely set up and injected all dependency components, including all its controllers.
Override this method to perform initializations in your custom controller
class instead of defining a constructor. Although the base implementation
does nothing it is good practice to call super.onInit()
in your
override method; especially if your custom controller class does not
extend from the base Controller
class directly.
Called whenever the Historian controller receives an incoming Query event.
Overwrite this method in a subclass to perform some side effect. Do not call this method in your application code, it is called by the framework.
The base method implementation does nothing. The method is only invoked
when shouldReplyToQueries
is set to true.
incoming Query event
Called whenever the Historian controller replies to an incoming Query with a Retrieve event.
Overwrite this method in a subclass to perform some side effect. Do not call this method in your application code, it is called by the framework.
The base method implementation does nothing. The method is only invoked
when shouldReplyToQueries
is set to true.
incoming Query event
array of Snapshot objects to be passed as Retrieve event data
Convenience method that queries snapshot objects for the given parent ID.
Returns an observable of matching snapshot objects ordered descendingly by creation timestamp.
object id from which snapshots were taken
Generated using TypeDoc
A controller which can be used on each Coaty agent to create and/or persist Snapshot objects in time of arbitrary Coaty objects.
Available controller options (default value for all options is
false
):shouldAdvertiseSnapshots
: iftrue
each generated Snapshot object will be advertisedshouldPersistLocalSnapshots
: iftrue
each Snapshot object generated will be persisted in a database collection if thedatabase
option is set with valid valuesshouldPersistObservedSnapshots
: iftrue
each Snapshot object observed as Advertise event will be persisted in database if thedatabase
option is set with valid values; Note: local snapshots will not be observed and hereby not persisted, ifshouldPersistLocalSnapshots
is not additionally set totrue
.shouldReplyToQueries
: iftrue
HistorianController will execute matching query events on the database if thedatabase
option is set with valid valuesdatabase
: with two propertieskey
andcollection
;key
references the database key as defined in thedatabases
option of your configuration;collection
is the name of the collection to be used. If the collection doesn't exist, it will be created in the given database.