Heartbeat Command & Time series Command¶
These commands are calling an endless loop to keep the system alive and to collect time series data.
Commands¶
Heartbeat Command¶
The timestamp of the last successful heartbeat is stored in a local file called HEARTBEAT. If the --only-if-elapsed option
is set, the command will only run if the last heartbeat was more than an interval which is to be configured.
The interval is set as an environment variable or in the .env file with the variable HEARTBEAT_INTERVAL. Additionally,
a grace period can be set with the environment variable HEARTBEAT_GRACE_PERIOD or in the .env file.
The endless loop is implemented as a self-dispatching message called HeartbeatMessage. The message is dispatched initially
by HeartbeatCommand. Then the message handler of HeartbeatMessage will keep on dispatching the message itself.
$this->messageBus->dispatch(
new HeartbeatMessage(),
[
new DelayStamp($this->heartbeatInterval * 1000),
new DispatchAfterCurrentBusStamp()
]
);
The following events are dispatched in the message handler:
Time series Command¶
For the time series, it is basically the same:
The timestamp of the last successful time-series run is stored in a local file called TIMESERIES. If the --only-if-elapsed option
is set, the command will only run if the last time series run was more than an interval which is to be configured.
The interval is set as an environment variable or in the .env file with the variable TIME_SERIES_INTERVAL. Additionally,
a grace period can be set with the environment variable TIME_SERIES_GRACE_PERIOD or in the .env file.
The endless loop is implemented as a self-dispatching message called TimeSeriesCollectionMessage. The message is dispatched initially
by TimeSeriesCommand. Then the message handler of HeartbeatMessage will keep on dispatching the message itself.
$this->messageBus->dispatch(
new TimeSeriesCollectionMessage(),
[
new DelayStamp($this->timeSeriesInterval * 1000),
new DispatchAfterCurrentBusStamp()
]
);
The following events are dispatched in the message handler: