March 7 - June 27, 2024 - Nstream is hitting the road with Confluent on the #DataInMotionTour! / Learn More

REST API Support

Although Nstream encourages using end-to-end streaming wherever possible, each Web Agent that is built with the Nstream Toolkit exposes the ability to receive a snapshot of its present state over a REST API.

Nstream Library Dependencies

Dependencies

Gradle

implementation 'io.nstream:nstream-adapter-common:4.9.16'

Maven

<dependency>
  <groupId>io.nstream</groupId>
  <artifactId>nstream-adapter-common</artifactId>
  <version>4.9.16</version>
  <type>module</type>
</dependency>

The REST API support is implemented in the nstream.adapter.common.patches.SummaryPatch class in the nstream-adapter-common module. Hence this functionality is avaiable to all classes that extend the SummaryPatch class which include:

Usage

Simply issue GET-type REST requests in the following format:

(mandatory)
endpoint: $HOST_URI/$NODE_URI?lane=api/unanswered
(optional headers)
Accept

For example, a sample cURL request to receive the data in JSON format for /agent/1 running on some-host.com:9001 could look like:

curl -XGET -H 'Accept: application/json' 'your-host.com/agent/1?lane=api/laneSummary'

The response, which:

might look like:

{
  "shared": {
    "s1": 1
  },
  "info": {
    "a": 1,
    "b": "2"
  },
  "map": {
    "data": [
      {
        "key": "k1",
        "value": "v1"
      },
      {
        "key": "k2",
        "value": "v2"
      }
    ]
  }
}

If /agent/1 consists of multiple traits, then all of the relevant lanes for all such traits within /agent/1 will be included in the summary paylod.

Limitations


Nstream is licensed under the Redis Source Available License 2.0 (RSALv2).