Merge pull request #158 from Tria-plc/dev

Pull updates from dev to alpha
This commit is contained in:
Stephanos A.
2026-06-14 23:06:21 +03:00
committed by GitHub

View File

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