Hero Supervisor Examples
This directory contains examples demonstrating Hero Supervisor functionality.
Available Examples
osiris_openrpc
Comprehensive example showing the complete workflow of using Hero Supervisor with OSIRIS runners via OpenRPC.
Features:
- Automatic supervisor and runner startup
- OpenRPC client communication
- Runner registration and management
- Job dispatching with multiple scripts
- Context-based access control
- Graceful shutdown
Run:
cargo run --example osiris_openrpc
See osiris_openrpc/README.md for details.
Prerequisites
All examples require:
- Redis server running on
localhost:6379 - Rust toolchain installed
Example Structure
examples/
├── README.md # This file
├── osiris_openrpc/ # OSIRIS + OpenRPC example
│ ├── main.rs # Main example code
│ ├── README.md # Detailed documentation
│ ├── note.rhai # Note creation script
│ ├── event.rhai # Event creation script
│ ├── query.rhai # Query script
│ └── access_denied.rhai # Access control test script
└── _archive/ # Archived old examples
Architecture Overview
The examples demonstrate the Hero Supervisor architecture:
Client (OpenRPC)
↓
Supervisor (OpenRPC Server)
↓
Redis Queue
↓
Runners (OSIRIS, SAL, etc.)
Development
To add a new example:
- Create a new directory under
examples/ - Add
main.rswith your example code - Add any required script files (
.rhai) - Add a
README.mddocumenting the example - Update
Cargo.tomlto register the example - Update this README with a link
Archived Examples
Previous examples have been moved to _archive/ for reference. These may be outdated but can provide useful patterns for specific use cases.