Revert "refactor: ( rabbitmq ) temporary remove the rabbitmq"

This reverts commit 3b961f17f5.
This commit is contained in:
Abubeker Yasin
2026-06-14 21:44:36 +03:00
parent 3b961f17f5
commit 4ab987e8fe

View File

@@ -1,67 +1,60 @@
import { Module } from "@nestjs/common"; import { Module } from "@nestjs/common";
import { HttpModule } from "@nestjs/axios"; import { HttpModule } from "@nestjs/axios";
// --- TEMPORARILY DISABLED: payment-event RabbitMQ consumer ---------------------------------- import { ConfigService } from "@nestjs/config";
// The payment broker is currently unreachable (DevOps is fixing it). @golevelup awaits the import { RabbitMQModule } from "@golevelup/nestjs-rabbitmq";
// @RabbitSubscribe registration during bootstrap, so an unreachable broker hangs the whole API import {
// and it never finishes starting. Disabled so the server boots without the broker. PAYMENT_EVENTS_DLX,
// TO RE-ENABLE (once the broker is back): uncomment the imports below, the RabbitMQModule entry PAYMENT_EVENTS_EXCHANGE,
// in `imports`, and PaymentEventsConsumer in `providers`. PAYMENT_QUEUES,
// import { ConfigService } from "@nestjs/config"; PaymentService,
// import { RabbitMQModule } from "@golevelup/nestjs-rabbitmq"; paymentServiceBindingPattern,
// import { } from "@edr/types";
// PAYMENT_EVENTS_DLX,
// PAYMENT_EVENTS_EXCHANGE,
// PAYMENT_QUEUES,
// PaymentService,
// paymentServiceBindingPattern,
// } from "@edr/types";
import { PaymentsController } from "./payments.controller"; import { PaymentsController } from "./payments.controller";
import { PaymentsService } from "./payments.service"; import { PaymentsService } from "./payments.service";
import { InternalPaymentsController } from "./internal-payments.controller"; import { InternalPaymentsController } from "./internal-payments.controller";
import { PaymentClientService } from "./payment-client.service"; import { PaymentClientService } from "./payment-client.service";
// import { PaymentEventsConsumer } from "./payment-events.consumer"; import { PaymentEventsConsumer } from "./payment-events.consumer";
import { ServiceAuthGuard } from "../../common/guards/service-auth.guard"; import { ServiceAuthGuard } from "../../common/guards/service-auth.guard";
import { SeatsModule } from "../seats/seats.module"; import { SeatsModule } from "../seats/seats.module";
import { TicketsModule } from "../tickets/tickets.module"; import { TicketsModule } from "../tickets/tickets.module";
// const PASSENGER_QUEUE = PAYMENT_QUEUES[PaymentService.PASSENGER]; const PASSENGER_QUEUE = PAYMENT_QUEUES[PaymentService.PASSENGER];
@Module({ @Module({
imports: [ imports: [
SeatsModule, SeatsModule,
TicketsModule, TicketsModule,
HttpModule.register({ timeout: 10_000 }), HttpModule.register({ timeout: 10_000 }),
// --- TEMPORARILY DISABLED (broker unreachable) — re-enable with the imports above. ------- RabbitMQModule.forRootAsync({
// RabbitMQModule.forRootAsync({ inject: [ConfigService],
// inject: [ConfigService], useFactory: (config: ConfigService) => ({
// useFactory: (config: ConfigService) => ({ uri: config.get<string>("rabbitmq.url") as string,
// uri: config.get<string>("rabbitmq.url") as string, exchanges: [
// exchanges: [ {
// { name: PAYMENT_EVENTS_EXCHANGE,
// name: PAYMENT_EVENTS_EXCHANGE, type: "topic",
// type: "topic", options: { durable: true },
// options: { durable: true }, },
// }, { name: PAYMENT_EVENTS_DLX, type: "topic", options: { durable: true } },
// { name: PAYMENT_EVENTS_DLX, type: "topic", options: { durable: true } }, ],
// ], queues: [
// queues: [ {
// { name: PASSENGER_QUEUE.dlq,
// name: PASSENGER_QUEUE.dlq, exchange: PAYMENT_EVENTS_DLX,
// exchange: PAYMENT_EVENTS_DLX, routingKey: paymentServiceBindingPattern(PaymentService.PASSENGER),
// routingKey: paymentServiceBindingPattern(PaymentService.PASSENGER), options: { durable: true },
// options: { durable: true }, },
// }, ],
// ], prefetchCount: config.get<number>("rabbitmq.prefetch") ?? 10,
// prefetchCount: config.get<number>("rabbitmq.prefetch") ?? 10, connectionInitOptions: { wait: false },
// connectionInitOptions: { wait: false }, }),
// }), }),
// }),
], ],
controllers: [PaymentsController, InternalPaymentsController], controllers: [PaymentsController, InternalPaymentsController],
providers: [ providers: [
PaymentsService, PaymentsService,
PaymentClientService, PaymentClientService,
// PaymentEventsConsumer, // TEMPORARILY DISABLED — re-enable with RabbitMQModule above. PaymentEventsConsumer,
ServiceAuthGuard, ServiceAuthGuard,
], ],
}) })