88 BlockingSender ,
99)
1010
11- from .address_helper import exchange_address
11+ from .address_helper import exchange_address , queue_address
1212from .common import CommonValues
1313from .configuration_options import (
1414 ReceiverOption ,
1515 SenderOption ,
1616)
17- from .entities import ExchangeSpecification
17+ from .entities import (
18+ ExchangeSpecification ,
19+ QueueSpecification ,
20+ )
1821
1922
2023class Management :
@@ -85,9 +88,6 @@ def _request(
8588
8689 # TO_COMPLETE HERE
8790
88- # TODO
89- # def declare_queue(self, name:str):
90-
9191 # TODO
9292 # def delete_queue(self, name:str):
9393
@@ -114,6 +114,32 @@ def declare_exchange(self, exchange_specification: ExchangeSpecification):
114114 ],
115115 )
116116
117+ def declare_queue (self , queue_specification : QueueSpecification ):
118+ body = {}
119+ body ["auto_delete" ] = queue_specification .is_auto_delete
120+ body ["durable" ] = queue_specification .is_durable
121+ body ["arguments" ] = {
122+ "x-queue-type" : queue_specification .queue_type .value ,
123+ "x-dead-letter-exchange" : queue_specification .dead_letter_exchange ,
124+ "x-dead-letter-routing-key" : queue_specification .dead_letter_routing_key ,
125+ "max-length-bytes" : queue_specification .max_len_bytes ,
126+ }
127+
128+ path = queue_address (queue_specification .name )
129+
130+ print (path )
131+
132+ self .request (
133+ body ,
134+ path ,
135+ CommonValues .command_put .value ,
136+ [
137+ CommonValues .response_code_201 .value ,
138+ CommonValues .response_code_204 .value ,
139+ CommonValues .response_code_409 .value ,
140+ ],
141+ )
142+
117143 # TODO
118144 # def delete_exchange(self, name:str):
119145
0 commit comments