Skip to content

Latest commit

 

History

History
94 lines (68 loc) · 2.67 KB

File metadata and controls

94 lines (68 loc) · 2.67 KB

:basic-app

:basic-app is the runnable Spring Boot example application for GortJava. It wires runtime, core, devices, events, persistence, drivers, and rest-spring-boot into one local app.

Documented for release 0.9.0.

Purpose

  • Provide a ready-to-run GortJava runtime.
  • Demonstrate JSON config loading, devices, rules, workflows, persistence, auth, plugins, cluster, Redis, WebSocket, and Arduino/Firmata.
  • Serve as the reference app for local development and manual testing.

Run

./gradlew :basic-app:bootRun

By default it loads:

apps/basic-app/config/iot.config.json

Switch configs with GORT_CONFIG_PATH:

GORT_CONFIG_PATH=apps/basic-app/config/iot.config.static-auth.json ./gradlew :basic-app:bootRun
GORT_CONFIG_PATH=apps/basic-app/config/iot.config.jwt-auth.json ./gradlew :basic-app:bootRun
GORT_CONFIG_PATH=apps/basic-app/config/iot.config.redis-persistence.json ./gradlew :basic-app:bootRun
GORT_CONFIG_PATH=apps/basic-app/config/iot.config.firmata.json ./gradlew :basic-app:bootRun

REST Checks

curl http://127.0.0.1:3000/api/gort/status
curl http://127.0.0.1:3000/api/gort/health
curl http://127.0.0.1:3000/api/gort/devices
curl -X POST http://127.0.0.1:3000/api/gort/devices/led1/commands \
  -H 'Content-Type: application/json' \
  -d '{"name":"on"}'

WebSocket

ws://127.0.0.1:3000/ws?replay=50

Use ?eventName=... and ?deviceId=... for filtered streams.

Console Events

The default config prints runtime events to the Spring Boot console, including sensor readings, rule executions, workflow transitions, and device commands:

EVENT device:temp1:sensor:reading {deviceId=temp1, deviceType=temperature, value=25.2}
EVENT rule:normal_temp_alert:executed {ruleId=normal_temp_alert}
EVENT device:led1:command:executed {deviceId=led1, deviceType=led, command=off}

Disable console event output with:

"runtime": {
  "logging": {
    "enabled": true,
    "console": false
  }
}

Config Files

  • iot.config.json: default mock app with file persistence.
  • iot.config.static-auth.json: static bearer token auth.
  • iot.config.jwt-auth.json: JWT auth using keys under apps/basic-app/keys.
  • iot.config.redis-persistence.json: Redis persistence.
  • iot.config.events.json: runtime event bridge examples.
  • iot.config.firmata.json: Arduino/Firmata example.
  • iot.config.profiles.json: profile merge example.
  • iot.config.plugin.json: plugin lifecycle example.
  • iot.config.cluster.*.json: control-plane and edge node examples.

Logs And Persistence

With the default config, runtime files are written under:

apps/basic-app/data/

That folder is ignored by Git.