Skip to content

Discovery

The OpenJAUS SDK implements the Discovery service such that a Component can function as any of the roles described in the Discovery Service Overiew. These are:

  • A registrant (client)
  • A querier (client)
  • A database (server)

Some control of which roles a Component will support is provided via the OpenJAUS configuration file. By default, a Component will support all roles.

This functionality is automatically included when you derive your Component from the EventsBase, Base, or Managed base Component classes.

The Database Role (server)

The database role within a Component can be disabled by setting the CMPT_xxx.DiscoveryServer.Enabled setting to false within the OpenJAUS configuration file. When set to true, a Component will host a Discovery server such that a RegisterServices message will populate the System Registry with the registering Component's information. It will also respond to all Query messages (QueryIdentification, QueryConfiguration, QueryServiceList, etc) with the appropriate Report message by pulling the information from the System Registry.

The Registrant Role (client)

By default, a Component will attempt to find and register itself with a Discovery server at startup. This behavior can be modified via the _GLOBAL_.DiscoveryClientSettings.QueryIdentificationBroadcastDuration setting. Note that this setting applies all components in the software process and cannot be changed on a per Component basis. There are four possible options for this setting:

  1. Disabled: The Component will not attempt to find and register itself with all Discovery servers in the System.
    • This disables any active attempt to find and register with a Discovery server. If a ReportIdentification message is received, it will perform the registration process with sending Component regardless of this setting.
  2. Continuous: The Component will periodically attempt to the find and (re)register itself with all Discovery servers in the System.
    • The interval at which to repeat this process is specified by the _GLOBAL_.DiscoveryClientSettings.QueryIdentificationBroadcastInterval_sec setting.
  3. UntilDiscoveryFound: The Component will periodically attempt to the find and (re)register itself with all Discovery servers in the System until it finds at least one Discovery server.
    • The interval at which to repeat this process is specified by the _GLOBAL_.DiscoveryClientSettings.QueryIdentificationBroadcastInterval_sec setting.
  4. OnceAtStartup: The Component will attempt to the find and (re)register itself with all Discovery servers in the System once at startup.
    • If no Discovery servers are found, the Component will not attempt to find and register itself again.

The Querier Role (client)

When supporting the Querier role, there are a few different options:

  1. In combination with the Registrant Role.
    • As part of the built-in registration process, the Component will query the Discovery server for a list of currently known discoverable Components and add them to the System Registry. Therefore, after the registration process is complete, you can query the SystemRegistry to see what Components may be available.
  2. Manually send a QueryServiceList message to a Discovery server.
    • By default, the ReportServiceList message returned by the server will be used to update the System Registry. The System Registry can then be queried to see what Components may be available.
    • NOTE: Currently, only new Components will be added to the System Registry. If a Component is no longer available, it will not be removed from the System Registry even if the ReportServiceList message indicates that it is no longer available.
  3. Override or extend the ReportServiceList message handler.
    • This allows you to customize the behavior of the Component when it receives a ReportServiceList message from a Discovery server. You could completely disable the built-in behavior or you could extend it to perform additional actions.

Additional Information