Skip to content

Commit 228a662

Browse files
committed
AMQP routing keys can be up to 255 characters in length
Signed-off-by: Lance-Drane <[email protected]>
1 parent 8b7dabd commit 228a662

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

http-2-broker/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use intersect_ingress_proxy_common::intersect_messaging::{
1212
extract_eventsource_data, INTERSECT_MESSAGE_EXCHANGE,
1313
};
1414
use intersect_ingress_proxy_common::protocols::amqp::{
15-
get_channel, get_connection, is_name_compliant, make_exchange,
15+
get_channel, get_connection, is_routing_key_compliant, make_exchange,
1616
};
1717
use intersect_ingress_proxy_common::signals::wait_for_os_signal;
1818
use intersect_ingress_proxy_common::telemetry::{
@@ -31,7 +31,7 @@ async fn send_message(configuration: &Settings, message: String, broker_data: Ar
3131
return;
3232
}
3333
let (topic, data) = es_data_result.unwrap();
34-
if !is_name_compliant(&topic) {
34+
if !is_routing_key_compliant(&topic) {
3535
tracing::warn!(
3636
"{} is not a valid AMQP topic name, will not attempt publish",
3737
topic

shared-deps/src/protocols/amqp.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,8 @@ pub fn is_name_compliant(name: &str) -> bool {
8787
.chars()
8888
.any(|c| !c.is_alphanumeric() && c != '-' && c != '_' && c != '.' && c != ':')
8989
}
90+
91+
/// make sure that the routing key is valid for AMQP
92+
pub fn is_routing_key_compliant(key: &str) -> bool {
93+
key.len() < 256
94+
}

0 commit comments

Comments
 (0)