Crate allora_runtime

Crate allora_runtime 

Source
Expand description

Allora – Integration Patterns & Message Flow Building Blocks

High-level, lightweight primitives for composing message-driven flows in Rust. Provides channels, messages, exchanges, simple filters/patterns, plus a facade (Runtime) for bootstrapping a runtime from a YAML configuration file.

§Key Concepts

  • Message – immutable payload + headers
  • Exchange – mutable processing context (in/out message, headers, correlation)
  • Channel – in-memory endpoint for sending/receiving Exchange instances
  • Filter (pattern) – predicate over an Exchange
  • Runtime – collection of declared channels & filters built from a spec

§Features

Async-only architecture; HTTP adapters and serialization always enabled (no feature flags).

§Crate Use

  • Programmatic: build channels/filters directly via builders
  • Declarative: provide allora.yml and use Runtime::new().run()

§Minimal Programmatic Example

use allora_core::{patterns::filter::Filter, Exchange, Message};
let mut exchange = Exchange::new(Message::from_text("ping"));
let f = Filter::new(|e: &Exchange| e.in_msg.body_text() == Some("ping"));
assert!(f.accepts(&exchange));

§Minimal YAML Channel Spec

version: 1
channels:
  - kind: direct
    id: inbound
  - kind: direct
    id: outbound

Build from file with:

let rt = Runtime::new().with_config_file("./allora.yml").run()?;
assert!(rt.channel_by_id("inbound").is_some());

§Building Components Directly

use allora_runtime::{build_channel_from_str, DslFormat, Channel};
let raw = "version: 1\nchannel:\n  kind: direct\n  id: demo";
let ch = build_channel_from_str(raw, DslFormat::Yaml).unwrap();
assert_eq!(ch.id(), "demo");

§Errors

All builder and facade operations surface failures via Error. Use Result<T, Error> and propagate with ?.

§License

MIT OR Apache-2.0.

§Stability & Versioning

  • Parsers enforce version.
  • New versions add new parser modules.

Re-exports§

pub use dsl::runtime::AlloraRuntime;
pub use dsl::build;
pub use dsl::build_channel;
pub use dsl::build_channel_from_str;
pub use dsl::build_filter;
pub use dsl::build_service;
pub use dsl::DslFormat;
pub use runtime::Runtime;
pub use inventory;

Modules§

adapter
channel
Channel module – lightweight in-process message pipes.
dsl
DSL Facade: multi-format (YAML today; JSON/XML forthcoming) configuration entry points.
endpoint
Endpoint abstraction: a lightweight FIFO inbox for Exchanges.
error
Error types and result alias for Allora.
logging
Logging utilities (internal use).
message
Messaging core types: Payload, Message, and Exchange.
patterns
Integration Patterns module: collection of Enterprise Integration Patterns (EIP) primitives.
processor
route
runtime
High-level application facade.
service
ServiceActivator trait: metadata & channel binding intent for a service (activator). Service trait: async-only business logic component.
service_activator_processor
spec
Spec module: programmatic component specification data models and format parsers.

Structs§

Adapter
Staged builder root: pattern-first entry (Adapter::inbound().http()...).
ClosureProcessor
DirectChannel
Direct, synchronous handoff channel.
EndpointBuilder
Staged builder root for endpoints.
Exchange
An exchange wraps an inbound and outbound message, plus routing properties.
Filter
HttpInboundAdapter
HttpInboundBuilder
HttpOutboundAdapter
HttpOutboundAdapterBuilder
InMemoryEndpoint
An in-memory FIFO endpoint for quick testing.
Message
A message containing a payload and headers (metadata).
OutboundDispatchResult
Metadata returned from outbound dispatch. Leave fields optional / expandable for future.
QueueChannel
Route
A Route represents an ordered pipeline of Processor implementations applied to an Exchange. Each processor can mutate the Exchange (e.g. enrich headers, transform the payload, set out_msg, assign correlation identifiers, etc.).
ServiceDescriptor

Enums§

EndpointSource
Source metadata describing origin of messages entering an endpoint.
Error
Mep
Message Exchange Pattern for HTTP inbound.
Payload
Represents the payload of a message, supporting text, bytes, JSON, or empty.

Traits§

Channel
Core channel trait providing send capabilities and metadata.
CorrelationSupport
Correlation lookup extension (QueueChannel only).
Endpoint
A trait representing a message endpoint for sending and receiving Exchange objects.
InboundAdapter
Inbound adapter: receives external data/events and produces Exchanges routed inside Allora.
InboundHttpExt
Extension trait adding .http() to the core InboundStage.
OutboundAdapter
Outbound adapter: sends data derived from an Exchange to an external system.
OutboundHttpExt
Extension trait adding .http() to the core OutboundStage.
PollableChannel
Dequeue extension (QueueChannel).
Processor
A Processor transforms an Exchange (async-only model).
Service
ServiceActivator
Internal metadata describing how a service is wired. Users do NOT implement this directly; it is derived from specs.
SubscribableChannel
Register-and-fanout extension trait (DirectChannel).

Functions§

all_service_descriptors
ensure_correlation
Ensure a correlation_id header exists on the inbound message of the provided Exchange. Safe to call multiple times (id will be stable after first generation).

Type Aliases§

BoxedProcessor
Boxed dynamic processor type. Useful for heterogeneous collections (used internally by Route).
ChannelRef
Type alias for a trait object reference to any Channel implementation.
Result