MCPcopy Create free account
hub / github.com/codealong-dev/ride-sharing / setupExchangesAndQueues

Method setupExchangesAndQueues

shared/messaging/rabbitmq.go:193–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191}
192
193func (r *RabbitMQ) setupExchangesAndQueues() error {
194 // First setup the DLQ exchange and queue
195 if err := r.setupDeadLetterExchange(); err != nil {
196 return err
197 }
198
199 err := r.Channel.ExchangeDeclare(
200 TripExchange, // name
201 "topic", // type
202 true, // durable
203 false, // auto-deleted
204 false, // internal
205 false, // no-wait
206 nil, // arguments
207 )
208 if err != nil {
209 return fmt.Errorf("failed to declare exchange: %s: %v", TripExchange, err)
210 }
211
212 if err := r.declareAndBindQueue(
213 FindAvailableDriversQueue,
214 []string{
215 contracts.TripEventCreated, contracts.TripEventDriverNotInterested,
216 },
217 TripExchange,
218 ); err != nil {
219 return err
220 }
221
222 if err := r.declareAndBindQueue(
223 DriverCmdTripRequestQueue,
224 []string{contracts.DriverCmdTripRequest},
225 TripExchange,
226 ); err != nil {
227 return err
228 }
229
230 if err := r.declareAndBindQueue(
231 DriverTripResponseQueue,
232 []string{contracts.DriverCmdTripAccept, contracts.DriverCmdTripDecline},
233 TripExchange,
234 ); err != nil {
235 return err
236 }
237
238 if err := r.declareAndBindQueue(
239 NotifyDriverNoDriversFoundQueue,
240 []string{contracts.TripEventNoDriversFound},
241 TripExchange,
242 ); err != nil {
243 return err
244 }
245
246 if err := r.declareAndBindQueue(
247 NotifyDriverAssignQueue,
248 []string{contracts.TripEventDriverAssigned},
249 TripExchange,
250 ); err != nil {

Callers 1

NewRabbitMQFunction · 0.95

Calls 2

declareAndBindQueueMethod · 0.95

Tested by

no test coverage detected