A tutorial application for teaching core Swim concepts. See a hosted version of this app running at https://cflt-bike-rental.nstream-demo.io.
-
- Ensure that your
JAVA_HOME
environment variable is pointed to your Java installation location. - Ensure that your
PATH
includes$JAVA_HOME
.
- Ensure that your
-
- Confirm that npm was installed during the Node.js installation.
- build.gradle — backend project configuration script
- gradle.properties — backend project configuration variables
- package.json — frontend project configuration
- rollup.config.js — frontend bundle configuration script
- src — backend source code, and configuration resources
- main/java — backend source code
- main/resources — backend configuration resources
- ui src — frontend source code
- gradle — support files for the
gradlew
build script
$ ./gradlew run
Open a web browser to http://localhost:9001.
The swim-cli is the simplest way to fetch or stream data from the web agents in this application
swim-cli installation details available here: https://www.swimos.org/backend/cli/
Note:
- Below swim-cli commands for introspection are for streaming locally running application.
- There is a hosted version of this application running here: https://cflt-bike-rental.nstream-demo.io/
- To stream APIs for the hosted version, replace
warp://localhost:9001
in below commands withwarps://cflt-bike-rental.nstream-demo.io
- CONSUMER:
swim-cli sync -h warp://localhost:9001 -n /consumer -l pulse
- STATION:
(Below, station "0efa08a3-1c38-48fe-ab37-8c9b72b20126" is used as an example)
- Latest status metrics of the station
swim-cli sync -h warp://localhost:9001 -n /station/0efa08a3-1c38-48fe-ab37-8c9b72b20126 -l latest
- Geographical coordinates of the station
swim-cli sync -h warp://localhost:9001 -n /station/0efa08a3-1c38-48fe-ab37-8c9b72b20126 -l geo
The Swim runtime exposes its internal subsystems as a set of meta web agents.
Use the swim:meta:host
agent to introspect a running host. Use the pulse
lane to stream high level stats:
swim-cli sync -h warp://localhost:9001 -n swim:meta:host -l pulse
The nodes
lane enumerates all agents running on a host:
swim-cli sync -h warp://localhost:9001 -n swim:meta:host -l nodes
The fragment part of the nodes
lane URI can contain a URI subpath filter:
swim-cli sync -h warp://localhost:9001 -n swim:meta:host -l nodes#/
You can stream the utilization of an individual web agent:
swim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fconsumer -l pulse
swim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fstation%2f0efa08a3-1c38-48fe-ab37-8c9b72b20126 -l pulse
swim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fstation%2f1879828885264130640 -l pulse
And discover its lanes:
swim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fconsumer -l lanes
swim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fstation%2f0efa08a3-1c38-48fe-ab37-8c9b72b20126 -l lanes
swim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fstation%2f1879828885264130640 -l lanes
swim-cli sync -h warp://localhost:9001 -n swim:meta:edge -l meshes