Endpoint Registry Service - Version 1.0-rc1

Abstract

This specification defines an endpoint registry extension to the xRegistry document format and API specification.

Table of Contents

Overview

This specification defines a registry of metadata definitions for abstract and concrete network endpoints to which messages can be produced, from which messages can be consumed, or which make messages available for subscriptions.

For easy reference, the JSON serialization of an Endpoint Registry adheres to this form:

{
  "specversion": "STRING",
  "registryid": "STRING",
  "self": "URL",
  "xid": "XID",
  "epoch": UINTEGER,
  "name": "STRING", ?
  "description": "STRING", ?
  "documentation": "URL", ?
  "labels": {
    "STRING": "STRING" *
  }, ?
  "createdat": "TIMESTAMP",
  "modifiedat": "TIMESTAMP",

  "model": { ... }, ?

  "endpointsurl": "URL",
  "endpointscount": UINTEGER,
  "endpoints": {
    "KEY": {
      "endpointid": "STRING",                   # xRegistry core attributes
      "self": "URL",
      "xid": "XID",
      "epoch": UINTEGER,
      "name": "STRING", ?
      "description": "STRING", ?
      "documentation": "URL", ?
      "labels": { "STRING": "STRING" * }, ?
      "createdat": "TIMESTAMP",
      "modifiedat": "TIMESTAMP",

      # Start of default Version's attributes
      "usage": "STRING",                        # subscriber, consumer, producer
      "channel": "STRING", ?
      "deprecated": {
        "effective": "TIMESTAMP", ?
        "removal": "TIMESTAMP", ?
        "alternative": "URL", ?
        "docs": "URL"?
      }, ?

      "envelope": "STRING", ?                   # e.g. CloudEvents/1.0
      "envelopeoptions": {
        "STRING": JSON-VALUE *

        # CloudEvents/1.0 options
        "mode": "STRING", ?                     # binary, structured
        "format": "STRING" ?                    # e.g. application/json
      },

      "protocol": "STRING", ?                   # e.g. HTTP/1.1
      "protocoloptions": {
        "STRING": JSON-VALUE *

        # Common protocol options
        "endpoints": [
          {
            "url": "URL"                        # plus endpoint extensions
          } *
        ], ?
        "authorization": {
          "type": "STRING", ?
          "resourceuri": "URI", ?
          "authorityuri": "URI", ?
          "grant_types": [ "STRING" * ] ?
        }, ?
        "deployed": BOOLEAN, ?

        # "HTTP" protocol options
        "method": "STRING", ?                          # Default: POST
        "headers": [ { "name": "STRING", "value": "STRING" } * ], ?
        "query": { "STRING": "STRING" * } ?

        # "AMQP/1.0" protocol options
        "node": "STRING", ?
        "durable": BOOLEAN, ?                          # Default: false
        "linkproperties": { "STRING": "STRING" * }, ?
        "connectionproperties": { "STRING": "STRING" * }, ?
        "distributionmode": "move" | "copy" ?          # Default: move

        # "MQTT/3.1.1" protocol options
        "topic": "STRING", ?
        "qos": UINTEGER, ?                             # Default: 0
        "retain": BOOLEAN, ?                           # Default: false
        "cleansession": BOOLEAN, ?                     # Default: true
        "willtopic": "STRING", ?
        "willmessage": "XID" ?

        # "MQTT/5.0" protocol options
        "topic": "STRING", ?
        "qos": UINTEGER, ?                             # Default: 0
        "retain": BOOLEAN, ?                           # Default: false
        "cleansession": BOOLEAN, ?                     # Default: true
        "willtopic": "STRING", ?
        "willmessage": "XID" ?

        # "KAFKA" protocol options
        "topic": "STRING", ?
        "acks": INTEGER, ?                             # Default: 1
        "key": "STRING", ?
        "partition": INTEGER, ?
        "consumergroup": "STRING", ?
        "headers": { "STRING": "STRING" * } ?

        # "NATS" protocol options
        "subject": "STRING" ?
      }, ?

      "messagegroups": [ XID * ], ?
      # End of default Version's attributes

      "messagesurl": "URL", ?
      "messagescount": UINTEGER, ?
      "messages": {
        "KEY": {                                # messageid
          # See Message Definition spec for details
        } *
      } ?
    } *
  } ?
}

Notations and Terminology

Notational Conventions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

For clarity, OPTIONAL attributes (specification-defined and extensions) are OPTIONAL for clients to use, but the servers' responsibility will vary. Server-unknown extension attributes MUST be silently stored in the backing datastore. Specification-defined, and server-known extension, attributes MUST generate an error if corresponding feature is not supported or enabled. However, as with all attributes, if accepting the attribute would result in a bad state (such as exceeding a size limit, or results in a security issue), then the server MAY choose to reject the request.

In the pseudo JSON format snippets ? means the preceding attribute is OPTIONAL, * means the preceding attribute MAY appear zero or more times, and + means the preceding attribute MUST appear at least once. The presence of the # character means the remaining portion of the line is a comment. Whitespace characters in the JSON snippets are used for readability and are not normative.

Terminology

This specification defines the following terms:

Endpoint

An "endpoint" is a logical or physical network location to which messages can be produced, from which messages can be consumed, or which makes messages available via subscription for delivery to a consumer-designated endpoint.

Endpoint Registry

The Endpoint Registry is a registry of metadata definitions for abstract and concrete network endpoints to which messages can be produced, from which messages can be consumed, or which makes messages available via subscription and delivery to a consumer-designated endpoint.

As discussed in CloudEvents Registry overview, endpoints are supersets of message definition groups and MAY contain inlined messages. Therefore, the Resources in the meta-model for the Endpoint Registry are likewise messages as defined in the message catalog specification.

The resource model for endpoints can be found in model.json.

Endpoints

Endpoints are a Group type with a plural name (GROUPS) of endpoints, and a singular name (GROUP) of endpoint.

The following attributes are defined for Endpoints:

usage

channel

deprecated

See the deprecated attribute in the core xRegistry specification.

envelope

envelopeoptions

This specification defines the following envelope options for the indicated envelope values:

CloudEvents/1.0

protocol

protocoloptions

protocoloptions.endpoints

protocoloptions.authorization

protocoloptions.authorization.type

protocoloptions.authorization.resourceuri

protocoloptions.authorization.authorityuri

protocoloptions.authorization.grant_types

protocoloptions.deployed

protocoloptions.options

messagegroups

The messagegroups attribute is an array of XID-references to message definition groups. The messagegroups attribute is used to reference message definition groups that are not inlined in the endpoint definition.

Example:

{
  "protocol": "HTTP/1.1",
  "protocoloptions": {
    "method": "POST"
  },
  "messagegroups": [
    "/messagegroups/mygroup"
  ]
}

messages

Endpoints are supersets of message definition groups and MAY contain inlined messages. See Message Definitions.

Example:

{
  "protocol": "HTTP/1.1",
  "protocoloptions": {
    "method": "POST"
  },

  "messagesurl": "...",
  "messagescount": 1,
  "messages": {
    "myevent": {
      "envelope": "CloudEvents/1.0",
      "envelopemetadata": {
        "attributes": {
          "type": {
            "value": "myevent"
          }
        }
      }
    }
  }
}

When this specification, and the message specification, are used with specifications such as CloudEvents, where a semantically unique identifier is used in a runtime message (e.g. CloudEvent's type attribute), it is STRONGLY RECOMMENDED that the messageid values of the message definitions for an Endpoint match that unique identifier and therefore be unique across all messages within the messages collection and the messages referenced by the messagegroups attribute. This will allow for an easily "lookup" from an incoming runtime message to it's related message definition.

However, there are times when this is not possible. For example, take the case where an Endpoint might have the same semantic message defined twice, once for a JSON serialization and once for an XML serialization. Using the same messageid value is not possible (even though the CloudEvent type attribute would be the same for both runtime messages), so one (or both) message definition's messageid values might not match the runtime message's type value. In those cases, finding the appropriate message definition will need to be done via examination of some other metadata - such as the message's envelopemetadata.type value along with its envelopeoptions.format value. These details are of scope for this specification to define and are left as an implementation detail.

Implementations MAY choose to generate an error if it detects duplicate messageid values across the messages collection message definitions and the messagegroups referenced message definitions, if that is the desired constraints for their users.

Protocol Options

The following protocol options (protocoloptions.options) are defined for the respective protocols. All of these are OPTIONAL.

HTTP options

The endpoint URIs for "HTTP" endpoints MUST be valid HTTP URIs using the "http" or "https" scheme.

The following options are defined for HTTP:

The values of all query and headers MAY contain placeholders using the RFC6570 Level 1 URI Template syntax. When the same placeholder is used in multiple properties, the value of the placeholder is assumed to be identical.

Example:

{
  "protocol": "HTTP/1.1",
  "protocoloptions": {
    "method": "POST",
    "headers": [
      {
        "name": "Content-Type",
        "value": "application/json"
      }
    ],
    "query": {
      "operation": "send"
    }
  }
}

AMQP options

The endpoint URIs for "AMQP" endpoints MUST be valid AMQP URIs using the "amqp" or "amqps" scheme. If the path portion of the URI is present, it MUST be a valid AMQP node name.

The following options are defined for AMQP endpoints.

The values of all linkproperties and connection-properties MAY contain placeholders using the RFC6570 Level 1 URI Template syntax. When the same placeholder is used in multiple properties, the value of the placeholder is assumed to be identical.

Example:

{
  "usage": "producer",
  "protocol": "AMQP/1.0",
  "protocoloptions": {
    "node": "myqueue",
    "durable": true,
    "linkproperties": {
      "mylinkproperty": "mylinkpropertyvalue"
    },
    "connection-properties": {
      "my-connection-property": "my-connection-property-value"
    },
    "distributionmode": "move"
  }
}

MQTT options

The endpoint URIs for "MQTT" endpoints MUST be valid MQTT URIs using the (informal) "mqtt" or "mqtts" scheme. If the path portion of the URI is present, it MUST be a valid MQTT topic name. The informal schemes "tcp" (plain TCP/1883), "ssl" (TLS TCP/8883), and "wss" (Websockets/443) MAY also be used, but MUST NOT have a path.

The following options are defined for MQTT endpoints.

Example:

{
  "usage": "producer",
  "protocol": "MQTT/5.0",
  "protocoloptions": {
    "topic": "mytopic",
    "qos": 1,
    "retain": false,
    "cleansession": false,
    "willtopic": "mytopic",
    "willmessage": "/messagegroups/mygroup/messages/mywillmessage"
  }
}

KAFKA options

The endpoint URIs for "Kafka" endpoints MUST be valid Kafka bootstrap server addresses. The scheme follows Kafka configuration usage, e.g. SSL://{host}:{port} or PLAINTEXT://{host}:{port}.

The following options are defined for Kafka endpoints.

Example:

{
  "usage": "producer",
  "protocol": "Kafka/2.0",
  "protocoloptions": {
    "topic": "mytopic",
    "acks": 1,
    "key": "mykey",
  }
}

NATS options

The endpoint URIs for "NATS" endpoints MUST be valid NATS URIs. The scheme MUST be "nats" or "tls" or "ws" and the URI MUST include a port number, e.g. nats://{host}:{port} or tls://{host}:{port}.

The following options are defined for NATS endpoints.

Example:

{
  "usage": "producer",
  "protocol": "NATS/1.0.0",
  "protocoloptions": {
    "subject": "mysubject"
  }
}

References