Skip to content

Command Component

The command component allows for listing all Xrt components, retrieving the state of a given component, as well as dynamic update of a component configuration. More information on these commands can be found in the Component Management documentation.

Command Component Configuration

Command Component Configuration Variables

Parameter Type Description Valid Values Required
Library String The shared library implementing the command component libxrt-command.so Y
Factory String The name of the C function used to instantiate the component xrt_command_factory Y
Name String The name of the component Y
Bus String The name of the bus component to use The name of an existing bus component Y
Logger String The name of the logger component to use The name of an existing logger component N
RequestTopic String The name of the topic on which to receive requests from the Bus Valid bus topic name. Default: xrt/request N
ReplyTopic String The name of the topic on which to publish request replies to the Bus Valid bus topic name. Default: xrt/reply N
DiscoveryTopic String The name of the topic on which to publish initial component discovery to the Bus Valid bus topic name. Default: xrt/discovery N

Example Configuration

An example command component configuration is provided below:

{
  "Library": "libxrt-command.so",
  "Factory": "xrt_command_factory",
  "Name": "command",
  "Bus": "bus",
  "Logger": "logger",
  "RequestTopic": "xrt/request",
  "ReplyTopic": "xrt/reply",
  "DiscoveryTopic": "xrt/discovery"
}

Initial Component Discovery

The command component supports the publication of component discovery information when an Xrt server first starts. This is published onto the configured command discovery topic.

Discovery example (partial):

{
  "type":"xrt.discovery:1.0",
  "node_id": "azathoth",
  "server_id": "bacnet-ip-server",
  "components":
  [
    {
      "name": "xrt",
      "state": "Running",
      "type": "XRT::Config",
      "category": "XRT::Core",
      "config": { "NodeId": "azathoth", "ServerId": "bacnet-ip-server" }
    },
    {
      "name": "logger",
      "state": "Running",
      "type": "IOT::Logger",
      "category": "IOT::Core",
      "config": { "Level": "Debug", "Name": "console" },
    }
  ]
}

In addition to the discovered component information, server_id and node_id fields are also generated that are used to identify the Xrt server instance and host node respectively. This supports using a shared discovery topic (between multiple Xrt servers) that can be used to manage discovery across multiple deployed instances. These values can either be set in the configuration for an Xrt configuration component or set as environment variables.

Discovery Scope Environment Variables

Variable Description Valid Values
XRT_SERVER_ID The server identifier for an Xrt instance (should be unique to a instance) If not configured defaults to a generated UUID string
XRT_NODE_ID The node identifier for an Xrt instance (should be unique to a node) If not configured defaults to an empty string