Expand description
§Kotoba Workflow Engine - Serverless Workflow Specification Compliant
Serverless Workflow (https://serverlessworkflow.io/) compliant workflow engine built on top of Kotoba’s graph rewriting system.
§Features
- Serverless Workflow DSL: JSON/YAML-based workflow definition compliant with SW specification
- Event-driven Execution: Supports event-driven workflows with CRON and time-based triggers
- Multi-protocol Support: HTTP, gRPC, OpenAPI, AsyncAPI, custom protocols
- Fault Tolerance: Comprehensive error handling with try-catch, raise patterns
- Platform Agnostic: Runs across diverse platforms and environments
- Extensible: Custom functions, extensions, and integration capabilities
§Serverless Workflow Example
use kotoba_workflow::prelude::*;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Serverless Workflow definition
let workflow_def = json!({
"document": {
"dsl": "1.0.0",
"namespace": "default",
"name": "order-processing",
"version": "1.0.0"
},
"do": [
{
"validateOrder": {
"call": "http",
"with": {
"method": "post",
"endpoint": "https://api.example.com/validate",
"body": "${ .order }"
}
}
},
{
"processPayment": {
"call": "http",
"with": {
"method": "post",
"endpoint": "https://payment.example.com/process"
}
}
}
]
});
// Parse and execute
let workflow = WorkflowEngine::from_json(workflow_def)?;
let result = workflow.execute(json!({"order": {"id": "123"}})).await?;
println!("Workflow completed: {:?}", result);
Ok(())
}
Re-exports§
pub use ir::WorkflowIR;
pub use ir::WorkflowExecution;
pub use ir::WorkflowExecutionId;
pub use ir::ExecutionStatus;
pub use ir::ActivityIR;
pub use ir::WorkflowStep;
pub use ir::WorkflowStepType;
pub use executor::ActivityRegistry;
pub use executor::Activity;
pub use executor::WorkflowExecutor;
pub use executor::WorkflowStateManager;
pub use store::WorkflowStore;
pub use store::StorageBackend;
pub use store::StorageFactory;
pub use store::EventSourcingManager;
pub use store::SnapshotManager;
pub use parser::ServerlessWorkflowParser;
pub use distributed::DistributedCoordinator;
pub use distributed::RoundRobinBalancer;
pub use distributed::LeastLoadedBalancer;
pub use distributed::NodeInfo;
pub use distributed::ClusterHealth;
pub use saga::SagaManager;
pub use saga::SagaExecutionEngine;
pub use saga::AdvancedSagaPattern;
pub use saga::SagaContext;
pub use monitoring::MonitoringManager;
pub use monitoring::MonitoringConfig;
pub use monitoring::WorkflowStats;
pub use monitoring::ActivityStats;
pub use monitoring::SystemHealth;
pub use optimization::WorkflowOptimizer;
pub use optimization::OptimizationStrategy;
pub use optimization::OptimizationResult;
pub use optimization::ParallelExecutionPlan;
pub use integrations::IntegrationManager;
pub use integrations::Integration;
pub use spec::*;
pub use activity::prelude::*;
Modules§
- activity
- Activity System - ワークフローActivity実行フレームワーク
- distributed
- Distributed Workflow Execution - Phase 2
- executor
- WorkflowExecutor - Temporalベースワークフロー実行器
- integrations
- External System Integrations - Phase 3
- ir
- WorkflowIR - TemporalベースワークフローIR定義
- monitoring
- Monitoring and Observability - Phase 3
- optimization
- Workflow Optimization - Phase 3
- parser
- Serverless Workflow Parser
- prelude
- Prelude for convenient imports
- saga
- Advanced Saga Pattern Implementation - Phase 3
- spec
- Serverless Workflow Specification Implementation
- store
- Workflow Store - プラガブルなワークフロー状態管理
Macros§
- track_
execution - ヘルパーマクロ for monitoring
Structs§
- Extended
Workflow Engine - Extended workflow engine - builds on core workflow functionality
- Workflow
Engine Builder - Workflow engine builder
- Workflow
Result - Extended workflow execution result with additional timing information