camel-component-api
Component API traits and extension points for rust-camel components.
Overview
camel-component-api defines the core Component, Endpoint, Consumer, and Producer contracts used by component crates.
It also re-exports common types from camel-api and URI helpers from camel-endpoint, so most component crates can depend on a single API crate.
Features
Componenttrait for scheme-based endpoint factoriesEndpoint,Consumer, and producer context contracts- New extension traits:
ComponentContext,ComponentRegistrar,ComponentBundle NoOpComponentContexthelper for tests and examples- Re-exports from
camel-api(e.g.CamelError,Exchange,BoxProcessor) - Re-exports from
camel-endpoint(UriConfig,UriComponents,parse_uri)
Installation
[]
= "0.5"
Usage
Implementing a Custom Component
use ;
;
Core Types
| Type | Description |
|---|---|
Component |
Factory for scheme-specific endpoints |
Endpoint |
Consumer/producer endpoint contract |
Consumer |
Pulls/receives exchanges from a source |
ProducerContext |
Runtime context for producer creation |
ConsumerContext |
Runtime context passed to consumers |
ComponentContext |
Read-only access to components, languages, and metrics |
ComponentRegistrar |
Dynamic component registration interface (Arc<dyn Component>) |
ComponentBundle |
Multi-scheme registration + TOML config contract |
NoOpComponentContext |
Lightweight test context with no registry lookups |
Extension Traits
use Arc;
use ;
// ComponentContext: provided to create_endpoint
// ComponentBundle: register multiple schemes from one config
;
// NoOpComponentContext: convenient for tests
let ctx = NoOpComponentContext;
let _endpoint = MyComponent.create_endpoint?;
Documentation
License
Apache-2.0