Getting Started

This section explains how to send JSON-formatted messages to the ScaleOut service using REST APIs.

Enable the REST service

The REST Messaging service is installed by default on all ScaleOut StateServer hosts. It is not started by default, so you will need to run the following commands to enable it:

net start soss-ac-msg

The REST Messaging service will start listening on port 8801.

Note

if you enable the REST Messaging service on all hosts, you can use a load balancer to distribute incoming messages across all hosts.

Sending a Message

An HTTP client can be used to send messages to specific object instances so that they can be processed by a custom messaging module. For example, to send a temperature reading from a wind turbine to an instance identified as “turbine1” in a module called “windTurbine”, you could use curl from a bash shell as follows:

curl -X POST "https://localhost:8801/api/v1/Messages/windTurbine/turbine1?apiKey=1234567890ABCDEF" -H "Content-Type: application/json" -d "[{ 'temp': 65, 'timestamp': $(date +%s) }]"

Python can be used to make the same request:

import requests
import time
requests.post('https://localhost:8801/api/v1/Messages/windTurbine/turbine1?apiKey=1234567890ABCDEF', json={"temp": "65", "timestamp": time.time()})

Important

The JSON messages you send to the REST API must match the message type(s) that you defined in your Java/C# message-processing project. If your message-handling code relies on special JSON features (like C#’s [JsonDerivedType] attribute), be sure that your JSON payload includes the supporting properties required by those features.