Skip to main content

camel_component_jms/
lib.rs

1//! JMS component for rust-camel — Apache ActiveMQ / Artemis bridge via Tower services.
2//!
3//! # Behavior changes (Phase B hardening)
4//!
5//! - **No automatic resend on transport errors** (breaking): Previously a send
6//!   transport error triggered a channel refresh + automatic retry. The retry
7//!   could duplicate non-idempotent writes. Now the channel is refreshed but
8//!   the original error is returned to the caller. Callers that want retry
9//!   semantics must implement it at the route level.
10//! - **max_bridges enforcement is now race-free**: Concurrent `get_or_create_slot`
11//!   calls are serialized during admission to prevent exceeding the configured
12//!   limit.
13//! - **Broker URLs are redacted in logs**: Userinfo (`user:pass@`) is replaced
14//!   with `***@` before logging.
15
16pub mod bundle;
17pub mod component;
18pub mod config;
19pub mod consumer;
20pub mod headers;
21pub mod health;
22pub mod producer;
23
24pub use bundle::JmsBundle;
25pub use camel_bridge::process::BrokerType;
26pub use component::{
27    BRIDGE_TRANSPORT_ERROR_PREFIX, BridgeSlot, BridgeState, JmsBridgePool, JmsComponent,
28    is_bridge_transport_error,
29};
30pub use config::default_bridge_cache_dir;
31pub use config::{
32    AcknowledgementMode, BrokerConfig, DestinationType, ExchangePattern, JmsEndpointConfig,
33    JmsPoolConfig, JmsTransactionMode,
34};
35pub use health::JmsHealthCheck;
36
37/// Version of the Java bridge binary this crate is compatible with.
38pub const BRIDGE_VERSION: &str = "0.5.0";
39
40/// Serializes tests that mutate `CAMEL_JMS_BRIDGE_BINARY_PATH` via
41/// `std::env::set_var`. Process-global env vars race under parallel test
42/// threads: one test's `/bin/false` override leaks into another test's
43/// bridge resolution window. This lock serializes only the affected tests
44/// (rc-alwn). Uses `std::sync::Mutex` (const-constructible for statics);
45/// each consumer test annotates `#[allow(clippy::await_holding_lock)]`
46/// because the guard is safe to hold across `.await` in test scope.
47#[cfg(test)]
48pub(crate) static BRIDGE_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
49
50pub mod proto {
51    tonic::include_proto!("jms_bridge");
52}