Neuron action

The action is used to publish result to the local neuron instance. Notice that, the sink is bound to the local neuron only which must be able to communicate through nanomsg ipc protocol without network. In the eKuiper side, all neuron source and sink instances share the same connection.

Property name Optional Description
groupName true The neuron group to be sent to. Allow to use template as a dynamic property. It is required when using non raw mode.
nodeName true The neuron node to be sent to. Allow to use template as a dynamic property. It is required when using non raw mode.
tags true The field names to be sent to neuron as a tag. If not specified, all result fields will be sent.
raw true Default to false. Whether to convert the data to neuron format by this sink or just publish the json or data template converted result.

Examples

Assume the sink receive result map like:

  1. {
  2. "temperature": 25.2,
  3. "humidity": 72,
  4. "status": "green",
  5. "node": "myNode"
  6. }

Send specify tags to neuron

Below is a sample neuron action configuration. In which, raw is false so the sink will convert the result map into neuron’s default format. The tags specify the tag names to be sent.

  1. {
  2. "neuron": {
  3. "groupName": "group1",
  4. "nodeName": "node1",
  5. "tags": ["temperature","humidity"]
  6. }
  7. }

This will send two tags temperature and humidity in group1, node1.

Send all keys as tags to neuron

This configuration does not specify tags property, thus it will send all the fields as tags.

  1. {
  2. "neuron": {
  3. "groupName": "group1",
  4. "nodeName": "node1"
  5. }
  6. }

This will send four tags temperature, humidity, status and node in group1, node1.

Send to dynamic node value

In the configuration, the nodeName property is a template which will retrieve the value of node field in the result map.

  1. {
  2. "neuron": {
  3. "groupName": "group1",
  4. "nodeName": "{{.node}}",
  5. "tags": ["temperature","humidity"]
  6. }
  7. }

Given this result, it will send end two tags temperature and humidity in group1, myNode.

Send with raw content

Below is another sample to publish data directly to neuron by the data template converted string. The raw is set, the format will be controlled by the data template.

  1. {
  2. "neuron": {
  3. "raw": true,
  4. "dataTemplate": "your template here"
  5. }
  6. }