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.
Advertises the given Coaty object and makes it discoverable either by its
objectType
or objectId
.
The optional shouldSetParentObjectId
parameter determines whether the
parent object ID of the given object should be set to the agent
identity's object ID (default is true
). This is required if you want to
observe the object's lifecycle info by method
observeObjectLifecycleInfoByObjectType
and to get notified when the
advertising agent terminates abnormally.
The returned subscription should be unsubscribed when the object is
deadvertised explicitely in your application code (see method
deadvertiseDiscoverableObject
). It will be automatically unsubscribed
when the communication manager is stopped.
a CoatyObject that is advertised and discoverable
determines whether the parent object ID of
the given object should be set to the agent identity's object ID (default
is true
)
the subscription on a DiscoverEvent observable that should be unsubscribed if no longer needed
Deadvertises the given Coaty object and unsubscribes the given
subscription resulting from a corresponding invocation of method
advertiseDiscoverableObject
.
Note that if you want to keep a Coaty object for the whole lifetime of its agent you don't necessarily need to invoke this method explicitely. Deadvertise events are published automatically by or on behalf of an agent whenever its communication manager is stopped or when the agent terminates abnormally.
a CoatyObject to be deadvertised
subscription on DiscoverEvent to be unsubscribed
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
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
Observes advertisements, deadvertisments and initial discoveries of
objects of the given core type. To track agent identity objects, specify
core type Identity
.
Specify an optional filter predicate to be applied to trackable objects.
If the predicate function returns true
, the object is being tracked;
otherwise the object is not tracked. If no predicate is specified, all
objects corresponding to the given core type are tracked.
the core type of objects to be tracked
a predicate for filtering objects to be tracked (optional)
an observable emitting changes concerning tracked objects of the given core type
Observes advertisements, deadvertisments and initial discoveries of objects of the given object type.
Specify an optional filter predicate to be applied to trackable objects.
If the predicate function returns true
, the object is being tracked;
otherwise the object is not tracked. If no predicate is specified, all
objects corresponding to the given core type are tracked.
the object type of objects to be tracked
a predicate for filtering objects to be tracked (optional)
an observable emitting changes concerning tracked objects of the given object type
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.
Readvertises the given Coaty object, usually after some properties have
changed. The object reference should have been advertised before once
using the method advertiseDiscoverableObject
.
a CoatyObject that should be advertised again after properties have changed
Generated using TypeDoc
Keeps track of agents or specific Coaty objects in a Coaty network by monitoring agent identities or custom object types.
This controller observes advertisements and deadvertisements of such objects and discovers them. Changes are emitted on corresponding observables that applications can subscribe to.
You can use this controller either standalone by adding it to the container components or extend your custom controller class from this controller class.
If you want to keep track of custom object types (not agent identities), you have to implement the remote side of the distributed object lifecycle management explicitely, i.e. advertise/readvertise/deadvertise your custom objects and observe/resolve corresponding Discover events. To facilitate this, this controller provides convenience methods:
advertiseDiscoverableObject
,readvertiseDiscoverableObject
, anddeadvertiseDiscoverableObject
.Usually, a custom object should have the object ID of its agent identity, i.e.
Container.identity
, set as itsparentObjectId
in order to be automatically deadvertised when the agent terminates abnormally. You can automate this by passingtrue
to the optional parametershouldSetParentObjectId
of methodadvertiseDiscoverableObject
(true
is also the default parameter value).