Skip to content

Configuring Services

Alexandr Krylovskiy edited this page Nov 7, 2014 · 4 revisions

Overview

Third-party services can be registered in the Service Catalog using the registrator utility and a configuration file described in this section.

Configuration File

{
  "host": "message-broker.local",
  "name": "MqttBroker",
  "description": "Demo MQTT Broker",
  "meta": {
    "serviceType": "_mqtt._tcp",
    "apiVersion": "3.1.1"
  },
  "ttl": 120,
  "protocols": [
    {
      "type": "MQTT",
      "endpoint": {
        "url": "tcp://mqtt-broker.local:1883"
      },
      "methods": [
        "PUB",
        "SUB"
      ],
      "content-types": []
    }
  ],
  "representation": {}
}

The configuration resembles the properties of the Service object described in the Service Catalog API, with the difference that instead of an id, the host (unique id (fqdn or IP address) of the host running the service) and name (name of the service) are used.

Registrator Utility

The registration utility is provided in the binary distribution at:

bin/service-registrator

It accepts two CLI arguments:

  • -conf path to the JSON configuration file of a service
  • -endpoint the URL of the Service Catalog API

Given the Service config file and the endpoint of the Service Catalog, the registrator utility registers the Service in the catalog and keeps updating the registration according to the configured TTL.

Simple Example

Taking the example configuration file shown above (conf/services/mqtt-broker.json), the desribed service can be registered as follows:

./bin/service-registrator -conf conf/services/mqtt-broker.json -endpoint http://127.0.0.1:8082/sc