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(crate) mod metadata;
23pub mod producer;
24
25pub use bundle::JmsBundle;
26pub use camel_bridge::process::BrokerType;
27pub use component::{
28    BRIDGE_TRANSPORT_ERROR_PREFIX, BridgeSlot, BridgeState, JmsBridgePool, JmsComponent,
29    is_bridge_transport_error,
30};
31pub use config::default_bridge_cache_dir;
32pub use config::{
33    AcknowledgementMode, BrokerConfig, DestinationType, ExchangePattern, JmsEndpointConfig,
34    JmsPoolConfig, JmsTransactionMode,
35};
36pub use health::JmsHealthCheck;
37
38/// Version of the Java bridge binary this crate is compatible with.
39pub const BRIDGE_VERSION: &str = "0.5.0";
40
41/// Serializes tests that mutate `CAMEL_JMS_BRIDGE_BINARY_PATH` via
42/// `std::env::set_var`. Process-global env vars race under parallel test
43/// threads: one test's `/bin/false` override leaks into another test's
44/// bridge resolution window. This lock serializes only the affected tests
45/// (rc-alwn). Uses `std::sync::Mutex` (const-constructible for statics);
46/// each consumer test annotates `#[allow(clippy::await_holding_lock)]`
47/// because the guard is safe to hold across `.await` in test scope.
48#[cfg(test)]
49pub(crate) static BRIDGE_ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
50
51pub mod proto {
52    tonic::include_proto!("jms_bridge");
53}