Operator EndpointSink
The EndpointSink operator enables data exchange between a Streams job and external clients. It receives generated tuples on its input ports and buffers them for retrieval by external clients. A management data service is started when an instance is started. This service accepts REST API GET requests to retrieve tuples from EndpointSink operators. An EndpointSink operator can have one or more input ports, each corresponding to an endpoint and each with a corresponding REST API URL.
A separate buffer is used to store received tuples for each endpoint. When an API call is made to retrieve data from an endpoint, the retrieved tuples can either remain in the buffer for other API requests or they can be removed from the buffer upon retrieval. The buffer size is also configurable to accommodate the flow of tuples through the operator. All ports in an operator share the same buffer size and the same buffered data removal behavior. To use different options for different endpoints, add multiple EndpointSink operators with different configuration values.
The @endpoint annotation can be used on an EndpointSink operator to provide customized content that is included with the generated API documentation for the endpoint. A description of the endpoint can be provided as well as descriptions for the tuple attributes.
Note: This operator currently is not supported in a consistent region or in a parallel region.
For more information, see the product documentation on enabling Streams data exchange.
Example
This example uses the EndpointSink operator.
composite Main {
graph
stream<float64 randomValue> NumberGenerator = Beacon() {
param period : 0.2;
output NumberGenerator : randomValue = random();
}
@endpoint (port=NumberGenerator, summary="Number consumer", tags="[\"Business Results\"]", description="Retrieves generated numbers for processing",
attributeDescriptions="{\"randomValue\": { \"description\": \"generated result value\" } }")
() as NumberSink = EndpointSink(NumberGenerator) {
param
bufferSize : 200;
consumingReads : true;
}
}
Summary
- Ports
- This operator has 1 or more input ports and 0 output ports.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator supports 2 parameters.
Optional: bufferSize, consumingReads
- Metrics
- This operator does not report any metrics.
Properties
- Implementation
- Java
- Ports (0)
- Properties
-
- Optional: false
- ControlPort: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
- Ports (1...)
-
- Properties
-
- ControlPort: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
Optional: bufferSize, consumingReads
- bufferSize
-
Identifies the size (in tuples) of each endpoint buffer. When the EndpointSink operator receives input tuples, it stores them in the endpoint buffer. If the buffer capacity is reached, older tuples are removed to make room for newer tuples. A warning is returned on an API request if the requested start time is before the oldest tuple in the buffer. The default buffer size is 1000.
- Properties
-
- Type: int32
- Cardinality: 1
- Optional: true
- consumingReads
-
Indicates whether tuples should be removed from the endpoint buffer after they have been retuned on a REST API call. The default value is false.
- Properties
-
- Type: boolean
- Cardinality: 1
- Optional: true
- Operator class library