AbstractAbstract implementation of basic functionalities of a Port
Port configuration options
Port logger, to be used internally
Port name, to be used as identifier
ReadonlyconfigPort configuration options
ReadonlynamePort name, to be used as identifier
ReadonlyuuidPort unique identifier for trace purposes
AbstractclientReturn the underlying port client
AbstractstateReturn the port state as a boolean value, true if the port is available, false in otherwise
Update or add a check measure. This should be used to inform about the state of resources behind the Port, for example memory usage, CPU usage, etc.
The new check will be taking into account in the overall health status.
The new check will be included in the checks object with the key indicated in the param
measure.* If this key already exists, the componentId of the check parameter will be
checked, if there is a check with the same componentId in the array, the check will be
updated, in other case the new check will be added to the existing array.
The maximum number external checks is 100
measure identification
check to be updated or included
true, if the check has been updated
AbstractcloseEmit an error event, to notify errors in the resource management or access, this will change
the provider state by the upper manager.
Emit a closed event, to notify that the access to the resources is not longer possible. This
event should not be emitted if Port.stop or Port.close methods are used. This
event will change the provider state by the upper manager.
Emit an unhealthy event, to notify that the port has limited access to the resources. This
event will change the provider state by the upper manager.
Emit a healthy event, to notify that the port has recovered the access to the resources. This
event will change the provider state by the upper manager.
healthy event
Add a listener for the error event, emitted when the component detects an error.
Add a listener for the closed event, emitted when the port resources are no longer available
Add a listener for the unhealthy event, emitted when the port has limited access to the
resources
Add a listener for the healthy event, emitted when the port has recovered the access to the
resources
healthy event
Healthy event listener
Add a listener for the error event, emitted when the component detects an error. This is a
one-time event, the listener will be removed after the first emission.
Add a listener for the closed event, emitted when the port resources are no longer available.
This is a one-time event, the listener will be removed after the first emission.
Add a listener for the unhealthy event, emitted when the port has limited access to the
resources. This is a one-time event, the listener will be removed after the first emission.
Add a listener for the healthy event, emitted when the port has recovered the access to the
resources. This is a one-time event, the listener will be removed after the first emission.
healthy event
Healthy event listener
AbstractstartAbstractstop
This is the class that should be extended to implement a new specific Port.
This class implements some util logic to facilitate the creation of new Ports, for this reason is exposed as abstract class, instead of an interface. The basic operations that already implemented in the class are:
What the user of this class should develop in the specific port:
In the other hand, this class extends the
EventEmitterclass, so it's possible to emit events to notify the status of the port:Check some examples of implementation in: