1
1
use lapin:: {
2
- options:: { BasicAckOptions , BasicGetOptions , BasicPublishOptions , QueueDeclareOptions } ,
3
- types:: FieldTable ,
2
+ options:: { BasicAckOptions , BasicGetOptions , BasicPublishOptions } ,
4
3
BasicProperties ,
5
4
} ;
6
5
@@ -15,8 +14,7 @@ use super::RabbitMQBroker;
15
14
impl QueueManagement for RabbitMQBroker {
16
15
async fn retry_queue (
17
16
& self ,
18
- queue_name : & str ,
19
- _disambiguator : Option < String > ,
17
+ queue_name : String ,
20
18
source_type : QueueType ,
21
19
) -> Result < usize , BroccoliError > {
22
20
let pool = self . ensure_pool ( ) ?;
@@ -34,6 +32,11 @@ impl QueueManagement for RabbitMQBroker {
34
32
"Cannot retry from ingestion queue" . into ( ) ,
35
33
) )
36
34
}
35
+ QueueType :: Fairness => {
36
+ return Err ( BroccoliError :: InvalidOperation (
37
+ "Cannot retry from fairness queue" . into ( ) ,
38
+ ) )
39
+ }
37
40
} ;
38
41
39
42
let mut count = 0 ;
@@ -44,7 +47,7 @@ impl QueueManagement for RabbitMQBroker {
44
47
channel
45
48
. basic_publish (
46
49
"broccoli" ,
47
- queue_name,
50
+ & queue_name,
48
51
BasicPublishOptions :: default ( ) ,
49
52
& delivery. data ,
50
53
BasicProperties :: default ( ) ,
@@ -60,35 +63,10 @@ impl QueueManagement for RabbitMQBroker {
60
63
Ok ( count)
61
64
}
62
65
63
- async fn get_queue_size (
66
+ async fn get_queue_status (
64
67
& self ,
65
- queue_name : & str ,
66
- queue_type : QueueType ,
67
- ) -> Result < usize , BroccoliError > {
68
- let pool = self . ensure_pool ( ) ?;
69
- let conn = pool
70
- . get ( )
71
- . await
72
- . map_err ( |e| BroccoliError :: Consume ( format ! ( "Failed to consume message: {e:?}" ) ) ) ?;
73
- let channel = conn. create_channel ( ) . await ?;
74
-
75
- let queue = match queue_type {
76
- QueueType :: Failed => format ! ( "{queue_name}_failed" ) ,
77
- QueueType :: Processing => format ! ( "{queue_name}_processing" ) ,
78
- QueueType :: Main => queue_name. to_string ( ) ,
79
- } ;
80
-
81
- let queue_info = channel
82
- . queue_declare (
83
- & queue,
84
- QueueDeclareOptions :: default ( ) ,
85
- FieldTable :: default ( ) ,
86
- )
87
- . await ?;
88
- Ok ( queue_info. message_count ( ) as usize )
89
- }
90
-
91
- async fn get_queue_status ( & self ) -> Result < Vec < QueueStatus > , BroccoliError > {
68
+ queue_name : Option < String > ,
69
+ ) -> Result < Vec < QueueStatus > , BroccoliError > {
92
70
let pool = self . ensure_pool ( ) ?;
93
71
let conn = pool
94
72
. get ( )
@@ -98,7 +76,7 @@ impl QueueManagement for RabbitMQBroker {
98
76
99
77
// List queues through management API or channel operations
100
78
// This is a simplified version - in practice you'd want to use the RabbitMQ Management API
101
- let mut statuses = Vec :: new ( ) ;
79
+ let statuses = Vec :: new ( ) ;
102
80
103
81
// Implementation note: RabbitMQ doesn't provide memory usage through regular AMQP
104
82
// You would need to use the HTTP Management API to get this information
0 commit comments