The command queue is used as a central message bus to orchestrate the single components.
Structure of a message
The structure of the message is described in the following table.
|0||4||session id length as 32 bit integer (s)|
|s + 4||1||Command id as byte|
|s + 5||data (optional)|
It can be seen that the first part of a message contains the session id of the benchmark to which the message belongs to (preceded by the session id length). After that, the id of the “command” follows as single byte. Some messages might have additional data that is simply added at the end of the message behind the command id.
The command queue uses a RabbitMQ Exchange. Connecting a component to this exchange can be done as described in the RabbitMQ Publish/Subscribe tutorial. The exchange itself has to be setup with:
- and no additional arguments.
The queue that is bound to the exchange can have an autogenerated name. The queue can be used to send messages to the exchange. Additionally, a consumer should be bound to the queue to be able to receive messages from the exchange.
Predefined command ids
The platform uses already predefined command ids. They can be reused by benchmark and system implementations if they are interacting with the platform. The predefined commands can be found in https://github.com/hobbit-project/core/blob/master/src/main/java/org/hobbit/core/Commands.java
|SYSTEM_READY_SIGNAL||1||The signal sent by the benchmarked system to indicate that the system is ready.|
|BENCHMARK_READY_SIGNAL||2||The signal sent by the benchmark controller to indicate that the benchmark is ready.|
|DATA_GENERATOR_READY_SIGNAL||3||The signal sent by the data generator to indicate that it is ready.|
|TASK_GENERATOR_READY_SIGNAL||4||The signal sent by the task generator to indicate that it is ready.|
|EVAL_STORAGE_READY_SIGNAL||5||The signal sent by the evaluation storage to indicate that it is ready.|
|EVAL_MODULE_READY_SIGNAL||6||The signal sent by the evaluation module to indicate that it is ready.|
|DOCKER_CONTAINER_START||12||Command used to ask a docker managing component to start a certain container. The command is followed by a String containing the following JSON data:
|DOCKER_CONTAINER_STOP||13||Command used to ask a docker managing component to stop a certain container. The command is followed by a String containing the following JSON data:
For implementing components, it is possible to use other than the predefined command ids. In this case it should be made sure that the used command ids do not overlap with the predefined ids. In general, it is recommended to use one an id of a free range listed in the following table.
|0 - 100||reserved for predefined commands|
|101 - 122||free|
|123||reserved for future extensions|
|124 - 255||free|