Skip to main content

queuerious_lapin/
lib.rs

1//! Queuerious SDK adapter for lapin (RabbitMQ).
2//!
3//! Wraps `lapin::Consumer` to automatically report job lifecycle events
4//! (started, completed, failed, retrying) to the Queuerious platform.
5//!
6//! # Quick Start
7//!
8//! ```no_run
9//! use queuerious::QueuriousClient;
10//! use queuerious_lapin::TrackedConsumer;
11//! use std::sync::Arc;
12//!
13//! # async fn example(channel: &lapin::Channel) -> Result<(), Box<dyn std::error::Error>> {
14//! let client = Arc::new(
15//!     QueuriousClient::builder()
16//!         .api_key("qk_your_key")
17//!         .build()?
18//! );
19//!
20//! let consumer = channel.basic_consume(
21//!     "my-queue", "my-consumer",
22//!     lapin::options::BasicConsumeOptions::default(),
23//!     lapin::types::FieldTable::default(),
24//! ).await?;
25//!
26//! let mut tracked = TrackedConsumer::new(consumer, "my-queue", client);
27//!
28//! // Use next_tracked() for full lifecycle tracking.
29//! while let Some(delivery) = tracked.next_tracked().await {
30//!     let delivery = delivery?;
31//!     // Process message...
32//!     delivery.ack(lapin::options::BasicAckOptions::default()).await?;
33//! }
34//! # Ok(())
35//! # }
36//! ```
37
38mod config;
39mod consumer;
40mod delivery;
41
42pub mod channel_factory;
43
44#[cfg(feature = "metrics")]
45pub mod metrics;
46
47#[cfg(feature = "commands")]
48pub mod commands;
49
50pub use channel_factory::{ChannelFactory, StaticConnectionFactory};
51pub use config::{extract_default_metadata, LapinAdapterConfig};
52pub use consumer::{TrackedConsumer, TrackedConsumerError};
53pub use delivery::TrackedDelivery;
54
55#[cfg(any(feature = "metrics", feature = "commands"))]
56mod runtime;
57
58#[cfg(feature = "commands")]
59pub use commands::RabbitMqCommandExecutor;
60
61#[cfg(any(feature = "metrics", feature = "commands"))]
62pub use runtime::{ObservabilityRuntime, RuntimeBuilder};