Skip to content

Commit 76f45c2

Browse files
Introduce QueueType::Unsupported
1 parent 9b881aa commit 76f45c2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/commons.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ pub enum QueueType {
346346
Quorum,
347347
Stream,
348348
// Tanzu RabbitMQ-specific
349-
Delayed
349+
Delayed,
350+
// A type this client is not aware of
351+
Unsupported
350352
}
351353

352354
impl From<&str> for QueueType {
@@ -356,7 +358,7 @@ impl From<&str> for QueueType {
356358
"quorum" => QueueType::Quorum,
357359
"stream" => QueueType::Stream,
358360
"delayed" => QueueType::Delayed,
359-
_ => QueueType::Classic,
361+
_ => QueueType::Unsupported,
360362
}
361363
}
362364
}
@@ -367,7 +369,7 @@ impl From<String> for QueueType {
367369
"classic" => QueueType::Classic,
368370
"quorum" => QueueType::Quorum,
369371
"stream" => QueueType::Stream,
370-
_ => QueueType::Classic,
372+
_ => QueueType::Unsupported,
371373
}
372374
}
373375
}
@@ -379,6 +381,7 @@ impl From<QueueType> for String {
379381
QueueType::Quorum => "quorum".to_owned(),
380382
QueueType::Stream => "stream".to_owned(),
381383
QueueType::Delayed => "delayed".to_owned(),
384+
QueueType::Unsupported => "unsupported".to_owned(),
382385
}
383386
}
384387
}
@@ -459,6 +462,7 @@ impl From<QueueType> for PolicyTarget {
459462
QueueType::Quorum => PolicyTarget::QuorumQueues,
460463
QueueType::Stream => PolicyTarget::Streams,
461464
QueueType::Delayed => PolicyTarget::Queues,
465+
QueueType::Unsupported => PolicyTarget::Queues,
462466
}
463467
}
464468
}

tests/unit_queue_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ fn test_unit_queue_type_from_str() {
3232

3333
assert_eq!(QueueType::Delayed, QueueType::from("delayed"));
3434
assert_eq!(QueueType::Delayed, QueueType::from("Delayed"));
35+
36+
assert_eq!(QueueType::Unsupported, QueueType::from("%%a-non-existent-type"));
3537
}
3638

3739
#[test]

0 commit comments

Comments
 (0)