Skip to content

Commit

Permalink
AMQP routing keys can be up to 255 characters in length
Browse files Browse the repository at this point in the history
Signed-off-by: Lance-Drane <[email protected]>
  • Loading branch information
Lance-Drane committed Oct 2, 2024
1 parent 8b7dabd commit 228a662
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions http-2-broker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use intersect_ingress_proxy_common::intersect_messaging::{
extract_eventsource_data, INTERSECT_MESSAGE_EXCHANGE,
};
use intersect_ingress_proxy_common::protocols::amqp::{
get_channel, get_connection, is_name_compliant, make_exchange,
get_channel, get_connection, is_routing_key_compliant, make_exchange,
};
use intersect_ingress_proxy_common::signals::wait_for_os_signal;
use intersect_ingress_proxy_common::telemetry::{
Expand All @@ -31,7 +31,7 @@ async fn send_message(configuration: &Settings, message: String, broker_data: Ar
return;
}
let (topic, data) = es_data_result.unwrap();
if !is_name_compliant(&topic) {
if !is_routing_key_compliant(&topic) {
tracing::warn!(
"{} is not a valid AMQP topic name, will not attempt publish",
topic
Expand Down
5 changes: 5 additions & 0 deletions shared-deps/src/protocols/amqp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ pub fn is_name_compliant(name: &str) -> bool {
.chars()
.any(|c| !c.is_alphanumeric() && c != '-' && c != '_' && c != '.' && c != ':')
}

/// make sure that the routing key is valid for AMQP
pub fn is_routing_key_compliant(key: &str) -> bool {
key.len() < 256
}

0 comments on commit 228a662

Please sign in to comment.