GitHub

Settings

Destinations

You can use destination adapters to subscribe every state change and send them to Elasticsearch, Firestore or your own custom REST API. For Elasticsearch, we support only elastic.co's cloud service for now.

If your destination adapter become unavailable, Rio retries to send the state change with an exponential backoff strategy. To configure your retry behavior, you should provide delay and max count.

Please make sure that your destination adapter id is unique in your project scope.

{
    public: {}, // public state
    user: {
        [userId]: {} // state available to userId
    },
    role: {
        [roleId]: {} // state available to roleId
    },
    private: {}, // private state
}

Destinations in Templates

To use any of these destinations, you should add them into your class templates.

destinations:
    - id: yourDestinationId
ParameterTypeRequiredDescription
idstringtrueDestination's unique ID

API Reference

ParameterTypeRequiredDescription
idstringtrueDestination's unique ID
typestring (Elasticsearch, Firestore, Http)trueDestination's type
pfactornumberfalseParallelization factor. If you set this, queue will be consumed by the number you provided in parallel
retryConfig.delaynumberfalsedelay multiplexer in seconds after a failed execution
retryConfig.countnumberfalsemaximum retry count after a failed execution

Concurrency

By default, destinations have instanceId based concurrency which means each instanceId has its own queue to push messages in order. These messages will be delivered in parallel by number of active instanceIds.

If you want to manage concurrency you should provide a parallelization factor in your destination configuration. When you set an integer greater than zero, core will limit concurrent threads to that value instead of number of active instanceIds.

Elasticsearch Support

ParameterTypeRequiredDescription
cloudIdstringtrueElasti.co's cloud id
usernamestringtrueElasti.co's username
passwordstringtrueElasti.co's password
indexstringtrueIndex name to push the data into

Http Support

ParameterTypeRequiredDescription
methodstringtrueHttp method
urlstringtrueRequest url
headers.<header_name>stringfalseRequest header's name and value

Dynamic Parameters In Destination Configuration

Destinations support VTL templates to allow you provide dynamic values in configuration. There are 3 different resources for accessing dynamic values: context, environment variables and state. You can access context and state via $data parameter while accessing environment variables through their own parameter called $env.

http://mydomain.com/$data.context.instanceId/$data.state.private.valueFromPrivateState/$env.ENV_VAR

Scan Jobs

You can scan and send instances to your destinations any time you want. All you have to do is to add a new scan job by selecting the class and destinations that you want to send instances to. Once the job started, it will be updated in realtime as long as it runs in background.

API Reference

ParameterTypeRequiredDescription
classIdstringtrueClass ID to scan the instances
destinationsstring[]trueDestinations to send the instances
Previous
Logs