Endpoint annotation

The SPL annotation @endpoint provides documentation to augment generated API documentation for a particular endpoint of the data exchange API that is associated with a Teracloud® Streams job.

1  @endpoint

This annotation is valid only on instances of the EndpointSource and EndpointSink operators, which are used to facilitate the actual injection or export of tuple data between the application and external clients. This annotation is optional and is not required to enable the data exchange support. It is often used in conjunction with the @service annotation to provide overarching documentation on a collection of endpoints exposed by an application.

For more information about Teracloud® Streams application services, see Enabling Streams data exchange.

The SPL compiler reports errors when an @endpoint annotation is applied in the following situations:

  • When @endpoint is placed on any operator that is not a primitive operator instance of either EndpointSource or EndpointSink.
  • When JSON validation fails on any parameters that require JSON object content.

Required elements

port
The name of the port that tuples are either injected to or exported from. The name must identify a port on the endpoint operator invocation to which the @endpoint annotation applies. The type of the parameter is rstring.

Optional elements

summary*
A short summary of what the API does. The type of the parameter is rstring.
tags*
A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. The type of the parameter is rstring. The format of the value is a JSON array of string tag names.
description*

A description of the API behavior. The type of the parameter is rstring.

attributeDescriptions
Information for the attributes that are defined by the stream of the port that is identified by the port parameter. The type of the parameter is rstring. The format of the value is a JSON object with embedded quotes escaped. Each object property name specifies an attribute name. The corresponding property value is a JSON object containing attribute metadata.

* For more information about these parameters, see the OpenAPI Specification, specifically focusing on the description of the Operation object.

Example

Provide customized API documentation for an endpoint of a Streams stock quote application enabled for data exchange:

@endpoint (port=QuoteSource, 
           summary="Feeds data into stock quote application.", 
           tags="[\"Input\"]",
           description="This endpoint accepts stock data for processing by the application.",
           attributeDescriptions="{\"ticker\": { \"description\": \"ticker symbol\" },
                                   \"price\":  { \"description\": \"recorded stock price\" }
                                  }")