EventRunner is a high-speed, high-throughput event processing engine designed to handle large volumes of events in real-time. It features flexible processing capabilities, robust data storage, tenant-specific event consumers using WebAssembly, and a comprehensive billing system.
graph TD
A[Client] --> B[Ory Oathkeeper]
B --> C[Ory Keto]
B --> D[EventRunner API]
E[HTTP Ingest Service] --> F[NATS JetStream]
G[gRPC Ingest Service] --> F
F --> H[EventRunner]
H --> I[NATS Processing Queue]
I --> J[EventEngine]
J --> K[(Scylla DB)]
K --> L[(ClickHouse)]
J --> M[Grule Rule Engine]
M --> J
I --> N[Tenant Event Streams]
N --> O[wasmCloud Runtime]
O --> P[OPA]
Q[Billing Service] --> L
R[Grafana] --> L
S[Prometheus] --> R
style B fill:#f9f,stroke:#333,stroke-width:2px
style C fill:#ff9,stroke:#333,stroke-width:2px
style D fill:#bfb,stroke:#333,stroke-width:2px
style H fill:#bbf,stroke:#333,stroke-width:2px
style J fill:#bfb,stroke:#333,stroke-width:2px
style K fill:#ff9,stroke:#333,stroke-width:2px
style L fill:#f96,stroke:#333,stroke-width:2px
style M fill:#9bf,stroke:#333,stroke-width:2px
style O fill:#fcf,stroke:#333,stroke-width:2px
style P fill:#ffc,stroke:#333,stroke-width:2px
- Ory Oathkeeper: API Gateway handling authentication and coarse-grained authorization.
- Ory Keto: Fine-grained authorization service based on Google Zanzibar.
- EventRunner API: Core API for managing the event processing system.
- Ingest Services: HTTP and gRPC services for event ingestion.
- NATS JetStream: High-performance message broker for event distribution.
- EventRunner: Processes raw events and converts them to CloudEvents.
- EventEngine: Applies business logic to events.
- Grule Rule Engine: RETE-enabled rule engine for flexible event processing.
- Scylla DB: Primary data storage for processed events.
- ClickHouse: Column-oriented DBMS for real-time analytics and billing data.
- wasmCloud Runtime: Executes WebAssembly modules as tenant-specific event consumers.
- Open Policy Agent (OPA): Provides authorization for wasmCloud-based consumers.
- Billing Service: Manages resource usage tracking and invoice generation.
- Grafana: Provides visualization for metrics and user-accessible dashboards.
- Prometheus: Collects and stores metrics from various system components.
- High-throughput event ingestion via HTTP and gRPC
- Scalable event processing using NATS JetStream
- Flexible event transformation and routing
- Powerful rule-based processing using the Grule Rule Engine
- Durable storage with Scylla DB
- Real-time analytics and billing with ClickHouse
- Tenant-specific event streaming and processing
- Secure, polyglot event consumer execution using WebAssembly and wasmCloud
- Fine-grained access control with Ory Keto for API and OPA for wasmCloud consumers
- Comprehensive billing and resource usage tracking
EventRunner uses Ory Oathkeeper as the API Gateway, which integrates with Ory Keto for fine-grained authorization decisions. For wasmCloud-based consumers, we use Open Policy Agent (OPA).
- Client sends a request to the API endpoint.
- Ory Oathkeeper authenticates the request.
- Oathkeeper consults Ory Keto for an authorization decision.
- If authorized, the request is forwarded to the appropriate EventRunner API service.
- The API service handles the request, assuming it's already authorized.
authorizers:
keto_engine_acp_ory:
enabled: true
config:
base_url: http://keto:4466
required_action: api:access
required_resource: api:resource
{
"namespace": "api",
"object": "resource:usage",
"relation": "access",
"subject": "user:[email protected]"
}
For wasmCloud-based consumers, we use OPA for fine-grained authorization. Here's an example OPA policy:
package eventrunner.wasmcloud
default allow = false
allow {
input.action == "process_event"
input.tenant_id == data.tenants[input.user].id
}
data.tenants = {
"alice": {"id": "tenant1"},
"bob": {"id": "tenant2"}
}
The billing system uses ClickHouse for storing and analyzing resource usage data.
CREATE TABLE tenant_usage (
tenant_id String,
timestamp DateTime,
cpu_usage Float64,
memory_usage Float64,
network_ingress Float64,
network_egress Float64
) ENGINE = MergeTree()
ORDER BY (tenant_id, timestamp);
GET /api/v1/usage/{tenant-id}
: Retrieve usage data for a specific tenantGET /api/v1/invoice/{tenant-id}
: Retrieve the latest invoice for a tenantGET /api/v1/invoice/{tenant-id}/{invoice-id}
: Retrieve a specific invoice
EventRunner supports the creation and execution of polyglot WebAssembly (Wasm) applications as event consumers using wasmCloud.
- Write your event consumer logic in your preferred language (e.g., Rust, Go, AssemblyScript).
- Compile your code to WebAssembly targeting the wasmCloud ABI.
- Sign your Wasm module with the appropriate capabilities for event processing.
Example Rust code for a simple event consumer:
use wasmbus_rpc::actor::prelude::*;
use wasmcloud_interface_messaging::*;
#[derive(Actor, MessageDispatch)]
#[services(Actor, MessageSubscriber)]
struct EventConsumer;
#[async_trait]
impl MessageSubscriber for EventConsumer {
async fn handle_message(&self, ctx: &Context, msg: &DeliverMessage) -> RpcResult<()> {
// Process the event
println!("Received event: {:?}", msg.body);
Ok(())
}
}
- Deploy Ory Oathkeeper and Ory Keto.
- Set up NATS JetStream, Scylla DB, and ClickHouse.
- Deploy the EventRunner API and associated services.
- Set up the wasmCloud runtime with OPA for tenant-specific event processing.
- Configure Grafana dashboards with ClickHouse as a data source.
Detailed deployment instructions can be found in the Deployment Guide.
Refer to the API Documentation for detailed information on using the EventRunner API.
For creating and deploying Wasm event consumers, see the Wasm Developer Guide.
Access Grafana dashboards through the EventRunner portal for:
- System-wide metrics and performance
- Tenant-specific resource usage and billing information
- Event processing statistics and latency metrics
We welcome contributions to EventRunner! Please see CONTRIBUTING.md for details on how to get started.
EventRunner is licensed under the Apache License 2.0. See LICENSE for the full license text.