camel-core
Core routing engine for rust-camel
Overview
camel-core is the heart of the rust-camel framework. It provides the CamelContext for managing routes, the Registry for component registration, and the core route execution engine. This crate orchestrates all the other components to enable message routing.
This is the main crate you'll use when building a rust-camel application. It brings together components, processors, and routes into a cohesive integration framework.
Features
- CamelContext: Central context for managing routes and components
- Registry: Component registry for endpoint resolution
- Route: Route definitions and lifecycle management
- RouteController: Start, stop, suspend, and resume routes
- Pipeline composition: Tower-based middleware composition
Installation
Add to your Cargo.toml:
[]
= "0.2"
Usage
Creating a Camel Context
use CamelContext;
use RouteBuilder;
async
Route Lifecycle Management
// Start a specific route
ctx.start_route.await?;
// Suspend a route (pause without stopping consumers)
ctx.suspend_route.await?;
// Resume a suspended route
ctx.resume_route.await?;
// Stop a route
ctx.stop_route.await?;
// Check route status
let status = ctx.route_status;
Core Types
| Type | Description |
|---|---|
CamelContext |
Main context for route management |
Registry |
Component and endpoint registry |
Route |
A configured route |
RouteDefinition |
Route builder output |
RouteController |
Lifecycle management trait |
Architecture
┌─────────────────────────────────────┐
│ CamelContext │
│ ┌─────────────────────────────┐ │
│ │ Registry │ │
│ │ ┌───────┐ ┌───────┐ │ │
│ │ │Timer │ │ Log │ ... │ │
│ │ │Comp │ │ Comp │ │ │
│ │ └───────┘ └───────┘ │ │
│ └─────────────────────────────┘ │
│ ┌─────────────────────────────┐ │
│ │ Routes │ │
│ │ Route 1 │ Route 2 │ ...│ │
│ └─────────────────────────────┘ │
└─────────────────────────────────────┘
Documentation
License
Apache-2.0
Contributing
Contributions are welcome! Please see the main repository for details.